-
Program runs off book's cd
Sorry about the empty post before.
I am also using that book (O'Reilly's Learning Java), and the code from the
accompanying cd compiles and runs. I find that book a little bit fast moving,
right from the start. Ivor Horton's book from Wrox takes about 20-30 pages
to explain Swing and making windows and JFrames and the like, (vs about 3
pages in the beginning of the OReilly book) which I found very helpful. He
starts with a basic JFrame window, just a title bar with working close box:
import javax.swing.*;
public class TryWindow
{
static JFrame aWindow = new JFrame("This is the window title");
public static void main( String [] args)
{
aWindow.setBounds(50,100,400,150); //position and size
aWindow.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
aWindow.setVisible(true);
}//end main
}//end TryWindow
Construct the JFrame, set the size, make it close, and make it visible.
Hope this helps.
John
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks