Sign in to follow this  

[java] swing tutorial question

This topic is 4855 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

DONT READ ! I just found the answer myself. The solution is the keyword static. Sorry. -------------------------------------------------------------- in the swing tutorial of java.com http://java.sun.com/docs/books/tutorial/uiswing/learn/example1.html i found this code: private static void createAndShowGUI() { //Make sure we have nice window decorations. JFrame.setDefaultLookAndFeelDecorated(true); //Create and set up the window. JFrame frame = new JFrame("HelloWorldSwing"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //Add the ubiquitous "Hello World" label. JLabel label = new JLabel("Hello World"); frame.getContentPane().add(label); //Display the window. frame.pack(); frame.setVisible(true); } i do not understand this line JFrame.setDefaultLookAndFeelDecorated(true); because JFrame is not an object, it is a class. so why can i use this method? the object frame is created after, why not before? [Edited by - kudi on August 27, 2004 7:35:01 AM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I don't want to sound condescending but maybe you should go back and learn the basics (i.e. the static keyword) before you tackle the Swing tutorial...

Share this post


Link to post
Share on other sites

This topic is 4855 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this