Jump to content
  • Advertisement
Sign in to follow this  
kudi

[java] swing tutorial question

This topic is 5021 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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!