All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object | +----java.awt.Component | +----java.awt.Container | +----java.awt.Window | +----java.awt.Frame | +----com.sun.java.swing.JFrame
The JFrame component contains a JRootPane as it's only child. The contentPane() should be the parent of any children of the JFrame. From the older java.awt.Window object you would normally do something:
dialog.add(child);Using JFrame the proper semantic is:
dialog.getContentPane().add(child);The same is true of setting LayoutManagers, removing components, listing children, etc. All these methods should normally be sent to the contentPane() instead of the JFrame itself. The contentPane() will always be non-null. Attempting to set it to null will cause the JFrame to throw an exception. The default contentPane() will have a BorderLayout manager set on it.
Please see the JRootPane documentation for a complete description of the contentPane(), glassPane(), and layeredPane() components.
protected JRootPane rootPane
public JFrame()
public JFrame(String title)
protected void frameInit()
protected JRootPane createRootPane()
protected void processKeyEvent(KeyEvent e)
public void setJMenuBar(JMenuBar menu)
public JMenuBar getJMenuBar()
public void setContentPane(Container content)
public Container getContentPane()
public void setLayeredPane(JLayeredPane layered)
public JLayeredPane getLayeredPane()
public void setGlassPane(Component glass)
public Component getGlassPane()
protected void setRootPane(JRootPane root)
public JRootPane getRootPane()
All Packages Class Hierarchy This Package Previous Next Index