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.
public Container getContentPane()Returns the contentPane object for this frame.
getContentPane in interface RootPaneContainer
the contentPane property