- java.lang.Object
- 
- java.awt.Component
- 
- java.awt.Container
- 
- javax.swing.JComponent
- 
- javax.swing.JRootPane
 
 
 
 
- 
- All Implemented Interfaces:
- ImageObserver,- MenuContainer,- Serializable,- Accessible
 
 public class JRootPane extends JComponent implements Accessible A lightweight container used behind the scenes byJFrame,JDialog,JWindow,JApplet, andJInternalFrame. For task-oriented information on functionality provided by root panes see How to Use Root Panes, a section in The Java Tutorial.The following image shows the relationships between the classes that use root panes. 
 The "heavyweight" components (those that delegate to a peer, or native component on the host system) are shown with a darker, heavier box. The four heavyweight JFC/Swing containers ( JFrame,JDialog,JWindow, andJApplet) are shown in relation to the AWT classes they extend. These four components are the only heavyweight containers in the Swing library. The lightweight containerJInternalFrameis also shown. All five of these JFC/Swing containers implement theRootPaneContainerinterface, and they all delegate their operations to aJRootPane(shown with a little "handle" on top).Note: The JComponentmethodgetRootPanecan be used to obtain theJRootPanethat contains a given component.
 The diagram at right shows the structure of aExample   JRootPane. AJRootpaneis made up of aglassPane, an optionalmenuBar, and acontentPane. (TheJLayeredPanemanages themenuBarand thecontentPane.) TheglassPanesits over the top of everything, where it is in a position to intercept mouse movements. Since theglassPane(like thecontentPane) can be an arbitrary component, it is also possible to set up theglassPanefor drawing. Lines and images on theglassPanecan then range over the frames underneath without being limited by their boundaries.Although the menuBarcomponent is optional, thelayeredPane,contentPane, andglassPanealways exist. Attempting to set them tonullgenerates an exception.To add components to the JRootPane(other than the optional menu bar), you add the object to thecontentPaneof theJRootPane, like this:rootPane.getContentPane().add(child);The same principle holds true for setting layout managers, removing components, listing children, etc. All these methods are invoked on thecontentPaneinstead of on theJRootPane.Note: The default layout manager for the If acontentPaneis aBorderLayoutmanager. However, theJRootPaneuses a customLayoutManager. So, when you want to change the layout manager for the components you added to aJRootPane, be sure to use code like this:rootPane.getContentPane().setLayout(new BoxLayout());JMenuBarcomponent is set on theJRootPane, it is positioned along the upper edge of the frame. ThecontentPaneis adjusted in location and size to fill the remaining area. (TheJMenuBarand thecontentPaneare added to thelayeredPanecomponent at theJLayeredPane.FRAME_CONTENT_LAYERlayer.)The layeredPaneis the parent of all children in theJRootPane-- both as the direct parent of the menu and the grandparent of all components added to thecontentPane. It is an instance ofJLayeredPane, which provides the ability to add components at several layers. This capability is very useful when working with menu popups, dialog boxes, and dragging -- situations in which you need to place a component on top of all other components in the pane.The glassPanesits on top of all other components in theJRootPane. That provides a convenient place to draw above all other components, and makes it possible to intercept mouse events, which is useful both for dragging and for drawing. Developers can usesetVisibleon theglassPaneto control when theglassPanedisplays over the other children. By default theglassPaneis not visible.The custom LayoutManagerused byJRootPaneensures that:- The glassPanefills the entire viewable area of theJRootPane(bounds - insets).
- The layeredPanefills the entire viewable area of theJRootPane. (bounds - insets)
- The menuBaris positioned at the upper edge of thelayeredPane.
- The contentPanefills the entire viewable area, minus themenuBar, if present.
 JRootPaneview hierarchy are ignored.If you replace the LayoutManagerof theJRootPane, you are responsible for managing all of these views. So ordinarily you will want to be sure that you change the layout manager for thecontentPanerather than for theJRootPaneitself!The painting architecture of Swing requires an opaque JComponentto exist in the containment hierarchy above all other components. This is typically provided by way of the content pane. If you replace the content pane, it is recommended that you make the content pane opaque by way ofsetOpaque(true). Additionally, if the content pane overridespaintComponent, it will need to completely fill in the background in an opaque color inpaintComponent.Warning: Swing is not thread safe. For more information see Swing's Threading Policy. 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 applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beanspackage. Please seeXMLEncoder.- Since:
- 1.2
- See Also:
- JLayeredPane,- JMenuBar,- JWindow,- JFrame,- JDialog,- JApplet,- JInternalFrame,- JComponent,- BoxLayout, Mixing Heavy and Light Components, Serialized Form
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description protected classJRootPane.AccessibleJRootPaneThis class implements accessibility support for theJRootPaneclass.protected classJRootPane.RootLayoutA custom layout manager that is responsible for the layout of layeredPane, glassPane, and menuBar.- 
Nested classes/interfaces declared in class javax.swing.JComponentJComponent.AccessibleJComponent
 - 
Nested classes/interfaces declared in class java.awt.ContainerContainer.AccessibleAWTContainer
 - 
Nested classes/interfaces declared in class java.awt.ComponentComponent.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
- 
 - 
Field SummaryFields Modifier and Type Field Description static intCOLOR_CHOOSER_DIALOGConstant used for the windowDecorationStyle property.protected ContainercontentPaneThe content pane.protected JButtondefaultButtonThe button that gets activated when the pane has the focus and a UI-specific action like pressing the Enter key occurs.static intERROR_DIALOGConstant used for the windowDecorationStyle property.static intFILE_CHOOSER_DIALOGConstant used for the windowDecorationStyle property.static intFRAMEConstant used for the windowDecorationStyle property.protected ComponentglassPaneThe glass pane that overlays the menu bar and content pane, so it can intercept mouse movements and such.static intINFORMATION_DIALOGConstant used for the windowDecorationStyle property.protected JLayeredPanelayeredPaneThe layered pane that manages the menu bar and content pane.protected JMenuBarmenuBarThe menu bar.static intNONEConstant used for the windowDecorationStyle property.static intPLAIN_DIALOGConstant used for the windowDecorationStyle property.static intQUESTION_DIALOGConstant used for the windowDecorationStyle property.static intWARNING_DIALOGConstant used for the windowDecorationStyle property.- 
Fields declared in class javax.swing.JComponentlistenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 - 
Fields declared in class java.awt.ComponentaccessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 - 
Fields declared in interface java.awt.image.ImageObserverABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
- 
 - 
Constructor SummaryConstructors Constructor Description JRootPane()Creates aJRootPane, setting up itsglassPane,layeredPane, andcontentPane.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected voidaddImpl(Component comp, Object constraints, int index)Overridden to enforce the position of the glass component as the zero child.protected ContainercreateContentPane()Called by the constructor methods to create the defaultcontentPane.protected ComponentcreateGlassPane()Called by the constructor methods to create the defaultglassPane.protected JLayeredPanecreateLayeredPane()Called by the constructor methods to create the defaultlayeredPane.protected LayoutManagercreateRootLayout()Called by the constructor methods to create the defaultlayoutManager.AccessibleContextgetAccessibleContext()Gets theAccessibleContextassociated with thisJRootPane.ContainergetContentPane()Returns the content pane -- the container that holds the components parented by the root pane.JButtongetDefaultButton()Returns the value of thedefaultButtonproperty.ComponentgetGlassPane()Returns the current glass pane for thisJRootPane.JMenuBargetJMenuBar()Returns the menu bar from the layered pane.JLayeredPanegetLayeredPane()Gets the layered pane used by the root pane.JMenuBargetMenuBar()Deprecated.As of Swing version 1.0.3 replaced bygetJMenuBar().RootPaneUIgetUI()Returns the L&F object that renders this component.StringgetUIClassID()Returns a string that specifies the name of the L&F class that renders this component.intgetWindowDecorationStyle()Returns a constant identifying the type of Window decorations theJRootPaneis providing.booleanisOptimizedDrawingEnabled()TheglassPaneandcontentPanehave the same bounds, which meansJRootPanedoes not tiles its children and this should return false.booleanisValidateRoot()If a descendant of thisJRootPanecallsrevalidate, validate from here on down.protected StringparamString()Returns a string representation of thisJRootPane.voidsetContentPane(Container content)Sets the content pane -- the container that holds the components parented by the root pane.voidsetDefaultButton(JButton defaultButton)Sets thedefaultButtonproperty, which determines the current default button for thisJRootPane.voidsetDoubleBuffered(boolean aFlag)Sets whether this component should use a buffer to paint.voidsetGlassPane(Component glass)Sets a specifiedComponentto be the glass pane for this root pane.voidsetJMenuBar(JMenuBar menu)Adds or changes the menu bar used in the layered pane.voidsetLayeredPane(JLayeredPane layered)Sets the layered pane for the root pane.voidsetMenuBar(JMenuBar menu)Deprecated.As of Swing version 1.0.3 replaced bysetJMenuBar(JMenuBar menu).voidsetUI(RootPaneUI ui)Sets the L&F object that renders this component.voidsetWindowDecorationStyle(int windowDecorationStyle)Sets the type of Window decorations (such as borders, widgets for closing a Window, title ...) theJRootPaneshould provide.voidupdateUI()Resets the UI property to a value from the current look and feel.- 
Methods declared in class javax.swing.JComponentaddAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 - 
Methods declared in class java.awt.Containeradd, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
 - 
Methods declared in class java.awt.Componentaction, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, 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, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
 
- 
 
- 
- 
- 
Field Detail- 
NONEpublic static final int NONE Constant used for the windowDecorationStyle property. Indicates that theJRootPaneshould not provide any sort of Window decorations.- Since:
- 1.4
- See Also:
- Constant Field Values
 
 - 
FRAMEpublic static final int FRAME Constant used for the windowDecorationStyle property. Indicates that theJRootPaneshould provide decorations appropriate for a Frame.- Since:
- 1.4
- See Also:
- Constant Field Values
 
 - 
PLAIN_DIALOGpublic static final int PLAIN_DIALOG Constant used for the windowDecorationStyle property. Indicates that theJRootPaneshould provide decorations appropriate for a Dialog.- Since:
- 1.4
- See Also:
- Constant Field Values
 
 - 
INFORMATION_DIALOGpublic static final int INFORMATION_DIALOG Constant used for the windowDecorationStyle property. Indicates that theJRootPaneshould provide decorations appropriate for a Dialog used to display an informational message.- Since:
- 1.4
- See Also:
- Constant Field Values
 
 - 
ERROR_DIALOGpublic static final int ERROR_DIALOG Constant used for the windowDecorationStyle property. Indicates that theJRootPaneshould provide decorations appropriate for a Dialog used to display an error message.- Since:
- 1.4
- See Also:
- Constant Field Values
 
 - 
COLOR_CHOOSER_DIALOGpublic static final int COLOR_CHOOSER_DIALOG Constant used for the windowDecorationStyle property. Indicates that theJRootPaneshould provide decorations appropriate for a Dialog used to display aJColorChooser.- Since:
- 1.4
- See Also:
- Constant Field Values
 
 - 
FILE_CHOOSER_DIALOGpublic static final int FILE_CHOOSER_DIALOG Constant used for the windowDecorationStyle property. Indicates that theJRootPaneshould provide decorations appropriate for a Dialog used to display aJFileChooser.- Since:
- 1.4
- See Also:
- Constant Field Values
 
 - 
QUESTION_DIALOGpublic static final int QUESTION_DIALOG Constant used for the windowDecorationStyle property. Indicates that theJRootPaneshould provide decorations appropriate for a Dialog used to present a question to the user.- Since:
- 1.4
- See Also:
- Constant Field Values
 
 - 
WARNING_DIALOGpublic static final int WARNING_DIALOG Constant used for the windowDecorationStyle property. Indicates that theJRootPaneshould provide decorations appropriate for a Dialog used to display a warning message.- Since:
- 1.4
- See Also:
- Constant Field Values
 
 - 
menuBarprotected JMenuBar menuBar The menu bar.
 - 
contentPaneprotected Container contentPane The content pane.
 - 
layeredPaneprotected JLayeredPane layeredPane The layered pane that manages the menu bar and content pane.
 - 
glassPaneprotected Component glassPane The glass pane that overlays the menu bar and content pane, so it can intercept mouse movements and such.
 - 
defaultButtonprotected JButton defaultButton The button that gets activated when the pane has the focus and a UI-specific action like pressing the Enter key occurs.
 
- 
 - 
Method Detail- 
setDoubleBufferedpublic void setDoubleBuffered(boolean aFlag) Sets whether this component should use a buffer to paint. If set to true, all the drawing from this component will be done in an offscreen painting buffer. The offscreen painting buffer will the be copied onto the screen. If aComponentis buffered and one of its ancestor is also buffered, the ancestor buffer will be used.- Overrides:
- setDoubleBufferedin class- JComponent
- Parameters:
- aFlag- if true, set this component to be double buffered
- Since:
- 1.6
 
 - 
getWindowDecorationStylepublic int getWindowDecorationStyle() Returns a constant identifying the type of Window decorations theJRootPaneis providing.- Returns:
- One of NONE,FRAME,PLAIN_DIALOG,INFORMATION_DIALOG,ERROR_DIALOG,COLOR_CHOOSER_DIALOG,FILE_CHOOSER_DIALOG,QUESTION_DIALOGorWARNING_DIALOG.
- Since:
- 1.4
- See Also:
- setWindowDecorationStyle(int)
 
 - 
setWindowDecorationStyle@BeanProperty(expert=true, visualUpdate=true, enumerationValues={"JRootPane.NONE","JRootPane.FRAME","JRootPane.PLAIN_DIALOG","JRootPane.INFORMATION_DIALOG","JRootPane.ERROR_DIALOG","JRootPane.COLOR_CHOOSER_DIALOG","JRootPane.FILE_CHOOSER_DIALOG","JRootPane.QUESTION_DIALOG","JRootPane.WARNING_DIALOG"}, description="Identifies the type of Window decorations to provide") public void setWindowDecorationStyle(int windowDecorationStyle) Sets the type of Window decorations (such as borders, widgets for closing a Window, title ...) theJRootPaneshould 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- styleis 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()
 
 - 
getUIpublic RootPaneUI getUI() Returns the L&F object that renders this component.- Overrides:
- getUIin class- JComponent
- Returns:
- LabelUIobject
- Since:
- 1.3
 
 - 
setUI@BeanProperty(expert=true, hidden=true, visualUpdate=true, description="The UI object that implements the Component\'s LookAndFeel.") public void setUI(RootPaneUI ui) Sets the L&F object that renders this component.- Parameters:
- ui- the- LabelUIL&F object
- Since:
- 1.3
- See Also:
- UIDefaults.getUI(javax.swing.JComponent)
 
 - 
updateUIpublic void updateUI() Resets the UI property to a value from the current look and feel.- Overrides:
- updateUIin class- JComponent
- See Also:
- JComponent.updateUI()
 
 - 
getUIClassIDpublic String getUIClassID() Returns a string that specifies the name of the L&F class that renders this component.- Overrides:
- getUIClassIDin class- JComponent
- Returns:
- the string "RootPaneUI"
- See Also:
- JComponent.getUIClassID(),- UIDefaults.getUI(javax.swing.JComponent)
 
 - 
createLayeredPaneprotected JLayeredPane createLayeredPane() Called by the constructor methods to create the defaultlayeredPane. Bt default it creates a newJLayeredPane.- Returns:
- the default layeredPane
 
 - 
createContentPaneprotected Container createContentPane() Called by the constructor methods to create the defaultcontentPane. By default this method creates a newJComponentadd sets aBorderLayoutas itsLayoutManager.- Returns:
- the default contentPane
 
 - 
createGlassPaneprotected Component createGlassPane() Called by the constructor methods to create the defaultglassPane. By default this method creates a newJComponentwith visibility set to false.- Returns:
- the default glassPane
 
 - 
createRootLayoutprotected LayoutManager createRootLayout() Called by the constructor methods to create the defaultlayoutManager.- Returns:
- the default layoutManager.
 
 - 
setJMenuBarpublic void setJMenuBar(JMenuBar menu) Adds or changes the menu bar used in the layered pane.- Parameters:
- menu- the- JMenuBarto add
 
 - 
setMenuBar@Deprecated public void setMenuBar(JMenuBar menu) Deprecated.As of Swing version 1.0.3 replaced bysetJMenuBar(JMenuBar menu).Specifies the menu bar value.- Parameters:
- menu- the- JMenuBarto add.
 
 - 
getJMenuBarpublic JMenuBar getJMenuBar() Returns the menu bar from the layered pane.- Returns:
- the JMenuBarused in the pane
 
 - 
getMenuBar@Deprecated public JMenuBar getMenuBar() Deprecated.As of Swing version 1.0.3 replaced bygetJMenuBar().Returns the menu bar value.- Returns:
- the JMenuBarused in the pane
 
 - 
setContentPanepublic void setContentPane(Container content) Sets the content pane -- the container that holds the components parented by the root pane.Swing's painting architecture requires an opaque JComponentin the containment hierarchy. This is typically provided by the content pane. If you replace the content pane it is recommended you replace it with an opaqueJComponent.- Parameters:
- content- the- Containerto use for component-contents
- Throws:
- IllegalComponentStateException- (a runtime exception) if the content pane parameter is- null
 
 - 
getContentPanepublic Container getContentPane() Returns the content pane -- the container that holds the components parented by the root pane.- Returns:
- the Containerthat holds the component-contents
 
 - 
setLayeredPanepublic void setLayeredPane(JLayeredPane layered) Sets the layered pane for the root pane. The layered pane typically holds a content pane and an optionalJMenuBar.- Parameters:
- layered- the- JLayeredPaneto use
- Throws:
- IllegalComponentStateException- (a runtime exception) if the layered pane parameter is- null
 
 - 
getLayeredPanepublic JLayeredPane getLayeredPane() Gets the layered pane used by the root pane. The layered pane typically holds a content pane and an optionalJMenuBar.- Returns:
- the JLayeredPanecurrently in use
 
 - 
setGlassPanepublic void setGlassPane(Component glass) Sets a specifiedComponentto 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.The new glass pane's visibility is changed to match that of the current glass pane. An implication of this is that care must be taken when you want to replace the glass pane and make it visible. Either of the following will work: root.setGlassPane(newGlassPane); newGlassPane.setVisible(true); or:root.getGlassPane().setVisible(true); root.setGlassPane(newGlassPane); - Parameters:
- glass- the- Componentto use as the glass pane for this- JRootPane
- Throws:
- NullPointerException- if the- glassparameter is- null
 
 - 
getGlassPanepublic Component getGlassPane() Returns the current glass pane for thisJRootPane.- Returns:
- the current glass pane
- See Also:
- setGlassPane(java.awt.Component)
 
 - 
isValidateRootpublic boolean isValidateRoot() If a descendant of thisJRootPanecallsrevalidate, 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 aJRootPaneor aJScrollPanebecause both classes overrideisValidateRootto return true.- Overrides:
- isValidateRootin class- JComponent
- Returns:
- true
- See Also:
- JComponent.isValidateRoot(),- Container.isValidateRoot()
 
 - 
isOptimizedDrawingEnabledpublic boolean isOptimizedDrawingEnabled() TheglassPaneandcontentPanehave the same bounds, which meansJRootPanedoes not tiles its children and this should return false. On the other hand, theglassPaneis normally not visible, and so this can return true if theglassPaneisn't visible. Therefore, the return value here depends upon the visibility of theglassPane.- Overrides:
- isOptimizedDrawingEnabledin class- JComponent
- Returns:
- true if this component's children don't overlap
 
 - 
setDefaultButton@BeanProperty(description="The button activated by default in this root pane") public void setDefaultButton(JButton defaultButton) Sets thedefaultButtonproperty, which determines the current default button for thisJRootPane. 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 aJTextPane). 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 tonull.- Parameters:
- defaultButton- the- JButtonwhich is to be the default button
- See Also:
- JButton.isDefaultButton()
 
 - 
getDefaultButtonpublic JButton getDefaultButton() Returns the value of thedefaultButtonproperty.- Returns:
- the JButtonwhich is currently the default button
- See Also:
- setDefaultButton(javax.swing.JButton)
 
 - 
addImplprotected void addImpl(Component comp, Object constraints, int index) Overridden to enforce the position of the glass component as the zero child.- Overrides:
- addImplin 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),- Container.invalidate(),- LayoutManager,- LayoutManager2
 
 - 
paramStringprotected String paramString() Returns a string representation of thisJRootPane. 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 benull.- Overrides:
- paramStringin class- JComponent
- Returns:
- a string representation of this JRootPane.
 
 - 
getAccessibleContextpublic AccessibleContext getAccessibleContext() Gets theAccessibleContextassociated with thisJRootPane. For root panes, theAccessibleContexttakes the form of anAccessibleJRootPane. A newAccessibleJRootPaneinstance is created if necessary.- Specified by:
- getAccessibleContextin interface- Accessible
- Overrides:
- getAccessibleContextin class- Component
- Returns:
- an AccessibleJRootPanethat serves as theAccessibleContextof thisJRootPane
 
 
- 
 
-