javax.swing
Class JRootPane

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JRootPane
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class JRootPane
extends JComponent
implements Accessible

This class is where JComponents are added to. Unlike awt where you could just say frame.add(), with swing you need to say frame.getRootPane() (which delivers an instance of this class) and add your components to that. It is implemented by several 'layers' (pane() should be read as plane()) each on top of the others where you can add components to. (getContentPane(), getGlassPane(), getLayeredPane())

See Also:
Serialized Form

Nested Class Summary
protected  class JRootPane.AccessibleJRootPane
           
protected  class JRootPane.RootLayout
           
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
static int COLOR_CHOOSER_DIALOG
           
protected  Container contentPane
          DOCUMENT ME!
protected  JButton defaultButton
           
protected  Action defaultPressAction
          Deprecated. since JDK1.3
protected  Action defaultReleaseAction
          Deprecated. since JDK1.3
static int ERROR_DIALOG
           
static int FILE_CHOOSER_DIALOG
           
static int FRAME
           
protected  Component glassPane
          DOCUMENT ME!
static int INFORMATION_DIALOG
           
protected  JLayeredPane layeredPane
          DOCUMENT ME!
protected  JMenuBar menuBar
          DOCUMENT ME!
static int NONE
           
static int PLAIN_DIALOG
           
static int QUESTION_DIALOG
           
static int WARNING_DIALOG
           
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
JRootPane()
          Creates a new JRootPane object.
 
Method Summary
protected  void addImpl(Component comp, Object constraints, int index)
          DOCUMENT ME!
protected  Container createContentPane()
          DOCUMENT ME!
protected  Component createGlassPane()
          DOCUMENT ME!
protected  JLayeredPane createLayeredPane()
          DOCUMENT ME!
protected  LayoutManager createRootLayout()
          DOCUMENT ME!
 AccessibleContext getAccessibleContext()
          Returns the accessible context for this JRootPane.
 Container getContentPane()
          DOCUMENT ME!
 JButton getDefaultButton()
           
 Component getGlassPane()
          DOCUMENT ME!
 JMenuBar getJMenuBar()
          DOCUMENT ME!
 JLayeredPane getLayeredPane()
          DOCUMENT ME!
 JMenuBar getMenuBar()
          Deprecated. Replaced by getJMenuBar()
 RootPaneUI getUI()
          DOCUMENT ME!
 String getUIClassID()
          DOCUMENT ME!
 int getWindowDecorationStyle()
           
 boolean isOptimizedDrawingEnable()
          This returns true if the glassPane is not visible because then the root pane can guarantee to tile its children (the only other direct child is a JLayeredPane which must figure its optimizeDrawingEnabled state on its own).
 boolean isValidateRoot()
          DOCUMENT ME!
 void setContentPane(Container p)
          Sets the JRootPane's content pane.
 void setDefaultButton(JButton newButton)
           
 void setGlassPane(Component f)
          DOCUMENT ME!
 void setJMenuBar(JMenuBar m)
          DOCUMENT ME!
 void setLayeredPane(JLayeredPane f)
          Set the layered pane for the root pane.
 void setMenuBar(JMenuBar m)
          Deprecated. Replaced by setJMenuBar()
 void setUI(RootPaneUI ui)
          DOCUMENT ME!
 void setWindowDecorationStyle(int style)
           
 void updateUI()
          DOCUMENT ME!
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, 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, setDoubleBuffered, setEnabled, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setNextFocusableComponent, setOpaque, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, 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, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, 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, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, 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, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, 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, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NONE

public static final int NONE
See Also:
Constant Field Values

FRAME

public static final int FRAME
See Also:
Constant Field Values

PLAIN_DIALOG

public static final int PLAIN_DIALOG
See Also:
Constant Field Values

INFORMATION_DIALOG

public static final int INFORMATION_DIALOG
See Also:
Constant Field Values

ERROR_DIALOG

public static final int ERROR_DIALOG
See Also:
Constant Field Values

COLOR_CHOOSER_DIALOG

public static final int COLOR_CHOOSER_DIALOG
See Also:
Constant Field Values

FILE_CHOOSER_DIALOG

public static final int FILE_CHOOSER_DIALOG
See Also:
Constant Field Values

QUESTION_DIALOG

public static final int QUESTION_DIALOG
See Also:
Constant Field Values

WARNING_DIALOG

public static final int WARNING_DIALOG
See Also:
Constant Field Values

glassPane

protected Component glassPane
DOCUMENT ME!


layeredPane

protected JLayeredPane layeredPane
DOCUMENT ME!


menuBar

protected JMenuBar menuBar
DOCUMENT ME!


contentPane

protected Container contentPane
DOCUMENT ME!


defaultButton

protected JButton defaultButton

defaultPressAction

protected Action defaultPressAction
Deprecated. since JDK1.3
This field is unused since JDK1.3. To override the default action you should modify the JRootPane's ActionMap.


defaultReleaseAction

protected Action defaultReleaseAction
Deprecated. since JDK1.3
This field is unused since JDK1.3. To override the default action you should modify the JRootPane's ActionMap.

Constructor Detail

JRootPane

public JRootPane()
Creates a new JRootPane object.

Method Detail

setJMenuBar

public void setJMenuBar(JMenuBar m)
DOCUMENT ME!

Parameters:
m - DOCUMENT ME!

setMenuBar

public void setMenuBar(JMenuBar m)
Deprecated. Replaced by setJMenuBar()


getJMenuBar

public JMenuBar getJMenuBar()
DOCUMENT ME!

Returns:
DOCUMENT ME!

getMenuBar

public JMenuBar getMenuBar()
Deprecated. Replaced by getJMenuBar()


isValidateRoot

public boolean isValidateRoot()
DOCUMENT ME!

Overrides:
isValidateRoot in class JComponent
Returns:
DOCUMENT ME!

getContentPane

public Container getContentPane()
DOCUMENT ME!

Returns:
DOCUMENT ME!

setContentPane

public void setContentPane(Container p)
Sets the JRootPane's content pane. The content pane should typically be opaque for painting to work properly. This method also removes the old content pane from the layered pane.

Parameters:
p - the Container that will be the content pane
Throws:
IllegalComponentStateException - if p is null

addImpl

protected void addImpl(Component comp,
                       Object constraints,
                       int index)
DOCUMENT ME!

Overrides:
addImpl in class Container
Parameters:
comp - DOCUMENT ME!
constraints - DOCUMENT ME!
index - DOCUMENT ME!

getGlassPane

public Component getGlassPane()
DOCUMENT ME!

Returns:
DOCUMENT ME!

setGlassPane

public void setGlassPane(Component f)
DOCUMENT ME!

Parameters:
f - DOCUMENT ME!

getLayeredPane

public JLayeredPane getLayeredPane()
DOCUMENT ME!

Returns:
DOCUMENT ME!

setLayeredPane

public void setLayeredPane(JLayeredPane f)
Set the layered pane for the root pane.

Parameters:
f - The JLayeredPane to be used.
Throws:
IllegalComponentStateException - if JLayeredPane parameter is null.

createRootLayout

protected LayoutManager createRootLayout()
DOCUMENT ME!

Returns:
DOCUMENT ME!

createContentPane

protected Container createContentPane()
DOCUMENT ME!

Returns:
DOCUMENT ME!

createGlassPane

protected Component createGlassPane()
DOCUMENT ME!

Returns:
DOCUMENT ME!

createLayeredPane

protected JLayeredPane createLayeredPane()
DOCUMENT ME!

Returns:
DOCUMENT ME!

getUI

public RootPaneUI getUI()
DOCUMENT ME!

Returns:
DOCUMENT ME!

setUI

public void setUI(RootPaneUI ui)
DOCUMENT ME!

Parameters:
ui - DOCUMENT ME!

updateUI

public void updateUI()
DOCUMENT ME!

Overrides:
updateUI in class JComponent

getUIClassID

public String getUIClassID()
DOCUMENT ME!

Overrides:
getUIClassID in class JComponent
Returns:
DOCUMENT ME!
See Also:
JComponent.setUI(javax.swing.plaf.ComponentUI), JComponent.updateUI()

getDefaultButton

public JButton getDefaultButton()

setDefaultButton

public void setDefaultButton(JButton newButton)

getWindowDecorationStyle

public int getWindowDecorationStyle()
Since:
1.4

setWindowDecorationStyle

public void setWindowDecorationStyle(int style)
Since:
1.4

isOptimizedDrawingEnable

public boolean isOptimizedDrawingEnable()
This returns true if the glassPane is not visible because then the root pane can guarantee to tile its children (the only other direct child is a JLayeredPane which must figure its optimizeDrawingEnabled state on its own).

Returns:
true if the glassPane is not visible

getAccessibleContext

public AccessibleContext getAccessibleContext()
Returns the accessible context for this JRootPane. This will be an instance of JRootPane.AccessibleJRootPane.

Specified by:
getAccessibleContext in interface Accessible
Overrides:
getAccessibleContext in class JComponent
Returns:
the accessible context for this JRootPane