I would never use Container contentPane = getContentPane().
Originally posted by Josh Rehman:
Gregg is wrong. getContentPane() does not return an AWT component. It returns an instance of JPanel. You can always do this:
JPanel is a subclass of java.awt.Container. Perhaps that's where the confusion comes from.
But JFrame doesn't have any special class for it's contentPane member. It's just a JPanel.
getContentPane
public Container getContentPane()Returns the contentPane object for this frame.
Specified by:
getContentPane in interface RootPaneContainer
Returns:
the contentPane property
-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Once upon a time there were three bears. And they were visted by a golden haired tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
|