This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes getContentPane() Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Reply Bookmark "getContentPane()" Watch "getContentPane()" New topic
Author

getContentPane()

smyle khanna
Ranch Hand

Joined: Jan 14, 2004
Posts: 54
Hi ,..
Can anyone tell me why do we use getContentPane() method?
When we can add Components directly to the Frame why do we use getContentPane?
And also Please provide me the swings hierachy....
I'm totally confusedwith this topic...
Plzzz help me out


Regards
Smyle
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8262

Sounds like you could use the Creating a GUI with Swing Tutorial. It has the answers to your questions like The structure of JFrame. As for the complete Swing hierarchy, either look at the Java Documentation starting with the javax.swing package or use the tutorial's visual index.
[ August 09, 2004: Message edited by: Joe Ess ]

"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
John McDonald
Ranch Hand

Joined: Jul 01, 2003
Posts: 112
Most of swing components are lightweight which means that swing components don't allocate the platform resoures like those of awt components. Yes, for Frame and Applet, you can add them directly but for not JApplet and JFrame. You have to first getContendPane as a place holder.

In addition, you need to override the paintComponent instead of paint. If I am short, please amend it, would you JGurus?

John
[ August 10, 2004: Message edited by: John McDonald ]
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: getContentPane()
 
Similar Threads
Java Bean and STruts
Usage of Tomahawk SourceCodeServlet
difference
Why Container?
Java Bean and STruts