Class java.awt.swing.JRootPane
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Container
|
+----java.awt.swing.JComponent
|
+----java.awt.swing.JRootPane
- public class JRootPane
- extends JComponent
- implements Accessible
The JRootPane component is made up of several components.
In order they are:
JRootPane
glassPane
layeredPane
[menuBar]
contentPane
The 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:
- The
glassPane
, if present, fills the entire viewable
area of the JRootPane (bounds - insets).
- The
layeredPane
fills the entire viewable area of the
JRootPane. (bounds - insets)
- The
menuBar
is positioned at the upper edge of the
layeredPane().
- The
contentPane
fills the entire viewable area,
minus the MenuBar, if present.
Any other views in the JRootPane view hierarchy are ignored.
If you replace the LayoutManager of the JRootPane, you are responsible for managing
all of these views.
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.
- See Also:
- JLayeredPane, JMenuBar, JWindow, JFrame, JDialog
Methods inherited from class java.awt.swing.JComponent
|
addAncestorListener, addNotify, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInsets, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getUIClassID, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, processComponentKeyEvent, processFocusEvent, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setAlignmentX, setAlignmentY, setAutoscrolls, setBorder, setBounds, setDebugGraphicsOptions, setDoubleBuffered, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVisible, unregisterKeyboardAction, update, updateUI |
Methods inherited from class java.awt.Container
|
add, add, add, add, add, addContainerListener, addImpl, addNotify, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paint, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setLayout, update, validate, validateTree |
Methods inherited from class java.awt.Component
|
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBounds, getColorModel, getComponentAt, getComponentAt, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getName, getParent, getPeer, getPreferredSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isDisplayable, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paint, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setCursor, setDropTarget, setEnabled, setFont, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, update, validate |
Methods inherited from class java.lang.Object
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
menuBar
protected JMenuBar menuBar
contentPane
protected Container contentPane
layeredPane
protected JLayeredPane layeredPane
glassPane
protected Component glassPane
defaultButton
protected JButton defaultButton
defaultPressAction
protected java.awt.swing.JRootPane.DefaultAction defaultPressAction
defaultReleaseAction
protected java.awt.swing.JRootPane.DefaultAction defaultReleaseAction
JRootPane
public JRootPane()
createLayeredPane
protected JLayeredPane createLayeredPane()
- Called by the constructor methods to create the default layeredPane.
Bt default it creates a new JLayeredPane.
createContentPane
protected Container createContentPane()
- Called by the constructor methods to create the default contentPane.
By default this method creates a new JComponent add sets a
BorderLayout as its LayoutManager.
createGlassPane
protected Component createGlassPane()
- Called by the constructor methods to create the default glassPane.
By default this method creates a new JComponent with visibility
set to false.
createRootLayout
protected LayoutManager createRootLayout()
- Called by the constructor methods to create the default layoutManager.
setMenuBar
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)
- Sets a specified Component to be the glass pane for this
root pane. The glass pane should normally be a lightweight,
transparent component, because it will be made visible when
ever the root pane needs to grab input events. For example,
only one JInternalFrame is ever active when using a
DefaultDesktop, and any inactive JInternalFrames' glass panes
are made visible so that clicking anywhere within an inactive
JInternalFrame can activate it.
- Parameters:
glass
- the Component to use as the glass pane for this
JRootPane.
getGlassPane
public Component getGlassPane()
- Returns the current glass pane for this JRootPane.
- Returns:
- the current glass pane.
setDefaultButton
public void setDefaultButton(JButton defaultButton)
- Sets the current default button for this JRootPane.
The default button is the button which will be activated
when a UI-defined activation event (typically the key)
occurs in the RootPane regardless of whether or not the button
has keyboard focus (unless there is another component within
the RootPane which consumes the activation event, such as a JTextPane).
For default activation to work, the button must be an enabled
descendent of the RootPane when activation occurs.
To remove a default button from this RootPane, set this
property to null.
- Parameters:
default
- the default button.
- See Also:
- isDefaultButton
getDefaultButton
public JButton getDefaultButton()
- Returns the current default button for this JRootPane.
- Returns:
- the current default button.
addImpl
protected void addImpl(Component comp,
Object constraints,
int index)
- Overridden to enforce the position of the glass component as the zero child.
- Overrides:
- addImpl in class Container
getAccessibleContext
public AccessibleContext getAccessibleContext()
- Get the AccessibleContext associated with this JComponent
- Implements:
- getAccessibleContext in interface Accessible
- Returns:
- the AccessibleContext of this JComponent
- Overrides:
- getAccessibleContext in class JComponent
Submit a bug or feature
Submit comments/suggestions about new javadoc look.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-1998 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.