javax.swing
Class JRootPane

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JRootPane
All Implemented Interfaces:
Accessible, java.awt.image.ImageObserver, MenuContainer, Serializable

public class JRootPane
extends JComponent
implements Accessible

Unsafe:

See Also:
Serialized Form

Field Summary
static int COLOR_CHOOSER_DIALOG
          Enabled: Constant used for the windowDecorationStyle property.
protected  Container contentPane
          The content pane.
protected  JButton defaultButton
          The button that gets activated when the pane has the focus and a UI-specific action like pressing the Enter key occurs.
protected  javax.swing.JRootPane.DefaultAction defaultPressAction
          Deprecated. As of Java 2 platform v1.3.
protected  javax.swing.JRootPane.DefaultAction defaultReleaseAction
          Deprecated. As of Java 2 platform v1.3.
static int ERROR_DIALOG
          Enabled: Constant used for the windowDecorationStyle property.
static int FILE_CHOOSER_DIALOG
          Enabled: Constant used for the windowDecorationStyle property.
static int FRAME
          Enabled: Constant used for the windowDecorationStyle property.
protected  Component glassPane
          The glass pane that overlays the menu bar and content pane, so it can intercept mouse movements and such.
static int INFORMATION_DIALOG
          Enabled: Constant used for the windowDecorationStyle property.
protected  JLayeredPane layeredPane
          The layered pane that manages the menu bar and content pane.
protected  JMenuBar menuBar
          The menu bar.
private  Component mostRecentFocusOwner
           
static int NONE
          Enabled: Constant used for the windowDecorationStyle property.
static int PLAIN_DIALOG
          Enabled: Constant used for the windowDecorationStyle property.
static int QUESTION_DIALOG
          Enabled: Constant used for the windowDecorationStyle property.
private static String uiClassID
           
static int WARNING_DIALOG
          Enabled: Constant used for the windowDecorationStyle property.
private  int windowDecorationStyle
           
 
Fields inherited from class javax.swing.JComponent
_bounds, accessibleContext, listenerList, paintingChild, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Container
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Constructor Summary
JRootPane()
          Suppressed: Creates a JRootPane, setting up its glassPane, layeredPane, and contentPane.
 
Method Summary
protected  void addImpl(Component comp, Object constraints, int index)
          Overridden to enforce the position of the glass component as the zero child.
 void addNotify()
          Suppressed: Register ourselves with the SystemEventQueueUtils as a new root pane.
protected  Container createContentPane()
          Called by the constructor methods to create the default contentPane.
protected  Component createGlassPane()
          Called by the constructor methods to create the default glassPane.
protected  JLayeredPane createLayeredPane()
          Called by the constructor methods to create the default layeredPane.
protected  LayoutManager createRootLayout()
          Called by the constructor methods to create the default layoutManager.
 AccessibleContext getAccessibleContext()
          Suppressed: Gets the AccessibleContext associated with this JRootPane.
 Container getContentPane()
          Suppressed: Returns the content pane -- the container that holds the components parented by the root pane.
 JButton getDefaultButton()
          Suppressed: Returns the value of the defaultButton property.
 Component getGlassPane()
          Suppressed: Returns the current glass pane for this JRootPane.
 JMenuBar getJMenuBar()
          Suppressed: Returns the menu bar from the layered pane.
 JLayeredPane getLayeredPane()
          Suppressed: Gets the layered pane used by the root pane.
 JMenuBar getMenuBar()
          Deprecated. As of Swing version 1.0.3 replaced by getJMenubar().
(package private)  Component getMostRecentFocusOwner()
           
 javax.swing.plaf.RootPaneUI getUI()
          Suppressed: Returns the L&F object that renders this component.
 String getUIClassID()
          Suppressed: Returns a string that specifies the name of the L&F class that renders this component.
 int getWindowDecorationStyle()
          Suppressed: Returns a constant identifying the type of Window decorations the JRootPane is providing.
 boolean isOptimizedDrawingEnabled()
          Suppressed: The glassPane and contentPane have the same bounds, which means JRootPane does not tiles its children and this should return false.
 boolean isValidateRoot()
          Suppressed: If a descendant of this JRootPane calls revalidate, validate from here on down.
protected  String paramString()
          Returns a string representation of this JRootPane.
 void removeNotify()
          Suppressed: Unregister ourselves from SystemEventQueueUtils.
 void setContentPane(Container content)
          Suppressed: Sets the content pane -- the container that holds the components parented by the root pane.
 void setDefaultButton(JButton defaultButton)
          Suppressed: Sets the defaultButton property, which determines the current default button for this JRootPane.
 void setGlassPane(Component glass)
          Suppressed: Sets a specified Component to be the glass pane for this root pane.
 void setJMenuBar(JMenuBar menu)
          Suppressed: Adds or changes the menu bar used in the layered pane.
 void setLayeredPane(JLayeredPane layered)
          Suppressed: Sets the layered pane for the root pane.
 void setMenuBar(JMenuBar menu)
          Deprecated. As of Swing version 1.0.3 replaced by setJMenuBar(JMenuBar menu).
(package private)  void setMostRecentFocusOwner(Component focusOwner)
           
 void setUI(javax.swing.plaf.RootPaneUI ui)
          Suppressed: Sets the L&F object that renders this component.
 void setWindowDecorationStyle(int windowDecorationStyle)
          Suppressed: Sets the type of Window decorations (such as borders, widgets for closing a Window, title ...) the JRootPane should provide.
 void updateUI()
          Suppressed: Resets the UI property to a value from the current look and feel.
 
Methods inherited from class javax.swing.JComponent
_paintImmediately, addAncestorListener, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, alwaysOnTop, checkIfChildObscuredBySibling, componentInputMapChanged, computeVisibleRect, computeVisibleRect, compWriteObjectNotify, contains, createToolTip, disable, enable, enableSerialization, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getCreatedDoubleBuffer, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getManagingFocusBackwardTraversalKeys, getManagingFocusForwardTraversalKeys, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getWriteObjCounter, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyBindings, processKeyBindingsForAllComponents, processKeyEvent, processMouseMotionEvent, putClientProperty, rectangleIsObscured, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setCreatedDoubleBuffer, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPaintingChild, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, setWriteObjCounter, shouldDebugGraphics, superProcessMouseMotionEvent, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, get, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, iterate, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, size, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, toString, transferFocus, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

uiClassID

private static final String uiClassID

NONE

public static final int NONE
Enabled: Constant used for the windowDecorationStyle property. Indicates that the JRootPane should not provide any sort of Window decorations.

Since:
1.4

FRAME

public static final int FRAME
Enabled: Constant used for the windowDecorationStyle property. Indicates that the JRootPane should provide decorations appropriate for a Frame.

Since:
1.4

PLAIN_DIALOG

public static final int PLAIN_DIALOG
Enabled: Constant used for the windowDecorationStyle property. Indicates that the JRootPane should provide decorations appropriate for a Dialog.

Since:
1.4

INFORMATION_DIALOG

public static final int INFORMATION_DIALOG
Enabled: Constant used for the windowDecorationStyle property. Indicates that the JRootPane should provide decorations appropriate for a Dialog used to display an informational message.

Since:
1.4

ERROR_DIALOG

public static final int ERROR_DIALOG
Enabled: Constant used for the windowDecorationStyle property. Indicates that the JRootPane should provide decorations appropriate for a Dialog used to display an error message.

Since:
1.4

COLOR_CHOOSER_DIALOG

public static final int COLOR_CHOOSER_DIALOG
Enabled: Constant used for the windowDecorationStyle property. Indicates that the JRootPane should provide decorations appropriate for a Dialog used to display a JColorChooser.

Since:
1.4

FILE_CHOOSER_DIALOG

public static final int FILE_CHOOSER_DIALOG
Enabled: Constant used for the windowDecorationStyle property. Indicates that the JRootPane should provide decorations appropriate for a Dialog used to display a JFileChooser.

Since:
1.4

QUESTION_DIALOG

public static final int QUESTION_DIALOG
Enabled: Constant used for the windowDecorationStyle property. Indicates that the JRootPane should provide decorations appropriate for a Dialog used to present a question to the user.

Since:
1.4

WARNING_DIALOG

public static final int WARNING_DIALOG
Enabled: Constant used for the windowDecorationStyle property. Indicates that the JRootPane should provide decorations appropriate for a Dialog used to display a warning message.

Since:
1.4

mostRecentFocusOwner

private Component mostRecentFocusOwner

windowDecorationStyle

private int windowDecorationStyle

menuBar

protected JMenuBar menuBar
The menu bar.


contentPane

protected Container contentPane
The content pane.


layeredPane

protected JLayeredPane layeredPane
The layered pane that manages the menu bar and content pane.


glassPane

protected Component glassPane
The glass pane that overlays the menu bar and content pane, so it can intercept mouse movements and such.


defaultButton

protected JButton defaultButton
The button that gets activated when the pane has the focus and a UI-specific action like pressing the Enter key occurs.


defaultPressAction

protected javax.swing.JRootPane.DefaultAction defaultPressAction
Deprecated. As of Java 2 platform v1.3.

As of Java 2 platform v1.3 this unusable field is no longer used. To override the default button you should replace the Action in the JRootPane's ActionMap. Please refer to the key bindings specification for further details.

See Also:
defaultButton

defaultReleaseAction

protected javax.swing.JRootPane.DefaultAction defaultReleaseAction
Deprecated. As of Java 2 platform v1.3.

As of Java 2 platform v1.3 this unusable field is no longer used. To override the default button you should replace the Action in the JRootPane's ActionMap. Please refer to the key bindings specification for further details.

See Also:
defaultButton
Constructor Detail

JRootPane

public JRootPane()
Suppressed: Creates a JRootPane, setting up its glassPane, layeredPane, and contentPane.

Method Detail

getWindowDecorationStyle

public int getWindowDecorationStyle()
Suppressed: Returns a constant identifying the type of Window decorations the JRootPane is providing.

Returns:
One of NONE, FRAME, PLAIN_DIALOG, INFORMATION_DIALOG, ERROR_DIALOG, COLOR_CHOOSER_DIALOG, FILE_CHOOSER_DIALOG, QUESTION_DIALOG or WARNING_DIALOG.
Since:
1.4
See Also:
setWindowDecorationStyle(int)

setWindowDecorationStyle

public void setWindowDecorationStyle(int windowDecorationStyle)
Suppressed: Sets the type of Window decorations (such as borders, widgets for closing a Window, title ...) the JRootPane should provide. The default is to provide no Window decorations (NONE).

This is only a hint, and some look and feels may not support this. This is a bound property.

Parameters:
windowDecorationStyle - Constant identifying Window decorations to provide.
Throws:
IllegalArgumentException - if style is not one of: NONE, FRAME, PLAIN_DIALOG, INFORMATION_DIALOG, ERROR_DIALOG, COLOR_CHOOSER_DIALOG, FILE_CHOOSER_DIALOG, QUESTION_DIALOG, or WARNING_DIALOG.
Since:
1.4
See Also:
JDialog.setDefaultLookAndFeelDecorated(boolean), JFrame.setDefaultLookAndFeelDecorated(boolean), LookAndFeel.getSupportsWindowDecorations()

getUI

public javax.swing.plaf.RootPaneUI getUI()
Suppressed: Returns the L&F object that renders this component.

Returns:
LabelUI object
Since:
1.3

setUI

public void setUI(javax.swing.plaf.RootPaneUI ui)
Suppressed: Sets the L&F object that renders this component.

Parameters:
ui - the LabelUI L&F object
Since:
1.3
See Also:
UIDefaults.getUI(javax.swing.JComponent)

updateUI

public void updateUI()
Suppressed: Resets the UI property to a value from the current look and feel.

Overrides:
updateUI in class JComponent
See Also:
JComponent.updateUI()

getUIClassID

public String getUIClassID()
Suppressed: Returns a string that specifies the name of the L&F class that renders this component.

Overrides:
getUIClassID in class JComponent
Returns:
the string "RootPaneUI"
See Also:
JComponent.getUIClassID(), UIDefaults.getUI(javax.swing.JComponent)

createLayeredPane

protected JLayeredPane createLayeredPane()
Called by the constructor methods to create the default layeredPane. Bt default it creates a new JLayeredPane.

Returns:
the default layeredPane

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.

Returns:
the default contentPane

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.

Returns:
the default glassPane

createRootLayout

protected LayoutManager createRootLayout()
Called by the constructor methods to create the default layoutManager.

Returns:
the default layoutManager.

setJMenuBar

public void setJMenuBar(JMenuBar menu)
Suppressed: Adds or changes the menu bar used in the layered pane.

Parameters:
menu - the JMenuBar to add

setMenuBar

public void setMenuBar(JMenuBar menu)
Deprecated. As of Swing version 1.0.3 replaced by setJMenuBar(JMenuBar menu).

Suppressed: Specifies the menu bar value.

Parameters:
menu - the JMenuBar to add.

getJMenuBar

public JMenuBar getJMenuBar()
Suppressed: Returns the menu bar from the layered pane.

Returns:
the JMenuBar used in the pane

getMenuBar

public JMenuBar getMenuBar()
Deprecated. As of Swing version 1.0.3 replaced by getJMenubar().

Suppressed: Returns the menu bar value.

Returns:
the JMenuBar used in the pane

setContentPane

public void setContentPane(Container content)
Suppressed: Sets the content pane -- the container that holds the components parented by the root pane.

Swing's painting architecture requires an opaque JComponent in the containment hiearchy. This is typically provided by the content pane. If you replace the content pane it is recommended you replace it with an opaque JComponent.

Parameters:
content - the Container to use for component-contents

getContentPane

public Container getContentPane()
Suppressed: Returns the content pane -- the container that holds the components parented by the root pane.

Returns:
the Container that holds the component-contents

setLayeredPane

public void setLayeredPane(JLayeredPane layered)
Suppressed: Sets the layered pane for the root pane. The layered pane typically holds a content pane and an optional JMenuBar.

Parameters:
layered - the JLayeredPane to use

getLayeredPane

public JLayeredPane getLayeredPane()
Suppressed: Gets the layered pane used by the root pane. The layered pane typically holds a content pane and an optional JMenuBar.

Returns:
the JLayeredPane currently in use

setGlassPane

public void setGlassPane(Component glass)
Suppressed: 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()
Suppressed: Returns the current glass pane for this JRootPane.

Returns:
the current glass pane
See Also:
setGlassPane(java.awt.Component)

isValidateRoot

public boolean isValidateRoot()
Suppressed: If a descendant of this JRootPane calls revalidate, validate from here on down.

Deferred requests to layout a component and its descendents again. For example, calls to revalidate, are pushed upwards to either a JRootPane or a JScrollPane because both classes override isValidateRoot to return true.

Overrides:
isValidateRoot in class JComponent
Returns:
true
See Also:
JComponent.isValidateRoot()

isOptimizedDrawingEnabled

public boolean isOptimizedDrawingEnabled()
Suppressed: The glassPane and contentPane have the same bounds, which means JRootPane does not tiles its children and this should return false. On the other hand, the glassPane is normally not visible, and so this can return true if the glassPane isn't visible. Therefore, the return value here depends upon the visiblity of the glassPane.

Overrides:
isOptimizedDrawingEnabled in class JComponent
Returns:
true if this component's children don't overlap

addNotify

public void addNotify()
Suppressed: Register ourselves with the SystemEventQueueUtils as a new root pane.

Overrides:
addNotify in class JComponent
See Also:
JComponent.registerKeyboardAction(java.awt.event.ActionListener, java.lang.String, javax.swing.KeyStroke, int)

removeNotify

public void removeNotify()
Suppressed: Unregister ourselves from SystemEventQueueUtils.

Overrides:
removeNotify in class JComponent
See Also:
addNotify()

setDefaultButton

public void setDefaultButton(JButton defaultButton)
Suppressed: Sets the defaultButton property, which determines 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 Enter key) occurs in the root pane regardless of whether or not the button has keyboard focus (unless there is another component within the root pane which consumes the activation event, such as a JTextPane). For default activation to work, the button must be an enabled descendent of the root pane when activation occurs. To remove a default button from this root pane, set this property to null.

See Also:
JButton.isDefaultButton()

getDefaultButton

public JButton getDefaultButton()
Suppressed: Returns the value of the defaultButton property.

Returns:
the JButton which is currently the default button
See Also:
setDefaultButton(javax.swing.JButton)

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
Parameters:
comp - the component to be enhanced
constraints - the constraints to be respected
index - the index
See Also:
Container.add(Component), Container.add(Component, int), Container.add(Component, java.lang.Object), LayoutManager, LayoutManager2

setMostRecentFocusOwner

void setMostRecentFocusOwner(Component focusOwner)

getMostRecentFocusOwner

Component getMostRecentFocusOwner()

paramString

protected String paramString()
Returns a string representation of this JRootPane. This method is intended to be used only for debugging purposes, and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null.

Overrides:
paramString in class JComponent
Returns:
a string representation of this JRootPane.

getAccessibleContext

public AccessibleContext getAccessibleContext()
Suppressed: Gets the AccessibleContext associated with this JRootPane. For root panes, the AccessibleContext takes the form of an AccessibleJRootPane. A new AccessibleJRootPane instance is created if necessary.

Specified by:
getAccessibleContext in interface Accessible
Overrides:
getAccessibleContext in class JComponent
Returns:
an AccessibleJRootPane that serves as the AccessibleContext of this JRootPane


comments?