All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object | +----java.awt.Component | +----java.awt.Container | +----com.sun.java.swing.JComponent | +----com.sun.java.swing.JRootPane
JRootPane glassPane layeredPane [menuBar] contentPaneThe menuBar component is optional and may or may exist at any time. The layeredPane, contentPane, and glassPane will always be available.
The contentPane
should be the parent of any children of
the JRootPane. You would normally do something like this:
rootPane.add(child);Using JRootPane the proper semantic is:
rootPane.getContentPane().add(child);The same priniciple holds true for setting layout managers, removing components, listing children, etc. All these methods should normally be sent to the
contentPane
instead of to the JRootPane.
The contentPane
is always non-null. Attempting to set it
to null generates an exception. The default contentPane
has a BorderLayout manager set on it.
If a JMenuBar component is set on the JRootPane, it is positioned
along the upper edge of the frame. The contentPane
is
adjusted in location and size to fill the remaining area.
The JMenuBar and the contentPane
are added
to the layeredPane
component at the
JLayeredPane.FRAME_CONTENT_LAYER layer.
The layeredPane
is an instance of the JLayeredPane class.
It's purpose is to be the parent of all children of the JRootPane. It
provides the ability to add components at several layers. This is very
useful when working with menu popups, dialog boxes, or during dragging.
Situations where you need to place a component over the top of all
other normal components. The layeredPane
is always non-null.
Attempting to set it to null generates an exception.
The glassPane
is always added as the first child of the
JRootPane. This allows the glass component to get in the way of all
mouse events, as well as providing a convient place to draw above all
other components. The glassPane
is always non-null.
Attempting to set it to null generates an exception. Developers should
use setVisible
on the glassPane to control when the
glassPane
displays over the other children. By default the
glassPane
is not visible.
The JRootPane uses a custom LayoutManager. This LayoutManager insures the following:
glassPane
, if present, fills the entire viewable
area of the JRootPane (bounds - insets).
layeredPane
fills the entire viewable area of the
JRootPane. (bounds - insets)
menuBar
is positioned at the upper edge of the
layeredPane().
contentPane
fills the entire viewable area,
minus the MenuBar, if present.
Warning: serialized objects of this class will not be compatible with future swing releases. The current serialization support is appropriate for short term storage or RMI between Swing1.0 applications. It will not be possible to load serialized Swing1.0 objects with future releases of Swing. The JDK1.2 release of Swing will be the compatibility baseline for the serialized form of Swing objects.
protected JMenuBar menuBarcontentPane
protected Container contentPanelayeredPane
protected JLayeredPane layeredPaneglassPane
protected Component glassPanedefaultButton
protected JButton defaultButtondefaultPressAction
protected JRootPane. DefaultAction defaultPressActiondefaultReleaseAction
protected JRootPane. DefaultAction defaultReleaseAction
public JRootPane()
protected JLayeredPane createLayeredPane()
protected Container createContentPane()
protected Component createGlassPane()
protected LayoutManager createRootLayout()
public void setMenuBar(JMenuBar menu)getMenuBar
public JMenuBar getMenuBar()setContentPane
public void setContentPane(Container content)getContentPane
public Container getContentPane()setLayeredPane
public void setLayeredPane(JLayeredPane layered)getLayeredPane
public JLayeredPane getLayeredPane()setGlassPane
public void setGlassPane(Component glass)
public Component getGlassPane()
public void setDefaultButton(JButton defaultButton)
public JButton getDefaultButton()
protected void addImpl(Component comp, Object constraints, int index)
public AccessibleContext getAccessibleContext()
All Packages Class Hierarchy This Package Previous Next Index