• Post Reply Bookmark Topic Watch Topic
  • New Topic

What is getContentPane method?  RSS feed

 
vinoth vino
Ranch Hand
Posts: 67
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I m new to Swing concept.
My Doubt is,
1.Can anyone tell me what is getContentPane() ? why we are using this? in Awt program we just use "setBackground(Color.Blue);" like this only,but here we are adding one more method ?
2.This is swing program only,then why we are importing "awt.*" and "awt.event.*; ?
3.What is the use of this setLocationRelativeTo(null) ?
4.when i click close button it closed without this(setDefaultCloseOperation(EXIT_ON_CLOSE);" Then what is the purpose of using this method? is this important to implement?
Please anyone help me ? Thanks in advance
 
Darryl Burke
Bartender
Posts: 5167
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The answers to all your questions can be found in the API. Have you read the API for JFrame and the RootPaneContainer interface it implements?
 
Rob Camick
Ranch Hand
Posts: 2801
15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have been given a link to the Swing tutorial. Read the tutorial and play with examples of the tutorial.

Your posted code looks nothing like the examples in the tutorial . For example, you should NOT be extending JFrame. You SHOULD be using "invokeLater()" to create the GUI.

Learn from the examples and from the API.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!