< prev index next >
src/java.desktop/share/classes/javax/swing/JRootPane.java
Print this page
*** 38,49 ****
import sun.security.action.GetBooleanAction;
/**
* A lightweight container used behind the scenes by
! * <code>JFrame</code>, <code>JDialog</code>, <code>JWindow</code>,
! * <code>JApplet</code>, and <code>JInternalFrame</code>.
* For task-oriented information on functionality provided by root panes
* see <a href="http://docs.oracle.com/javase/tutorial/uiswing/components/rootpane.html">How to Use Root Panes</a>,
* a section in <em>The Java Tutorial</em>.
*
* <p>
--- 38,49 ----
import sun.security.action.GetBooleanAction;
/**
* A lightweight container used behind the scenes by
! * {@code JFrame}, {@code JDialog}, {@code JWindow},
! * {@code JApplet}, and {@code JInternalFrame}.
* For task-oriented information on functionality provided by root panes
* see <a href="http://docs.oracle.com/javase/tutorial/uiswing/components/rootpane.html">How to Use Root Panes</a>,
* a section in <em>The Java Tutorial</em>.
*
* <p>
*** 52,175 ****
* <p style="text-align:center"><img src="doc-files/JRootPane-1.gif"
* alt="The following text describes this graphic."
* HEIGHT=484 WIDTH=629></p>
* 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 (<code>JFrame</code>, <code>JDialog</code>,
! * <code>JWindow</code>, and <code>JApplet</code>) are
* shown in relation to the AWT classes they extend.
* These four components are the
* only heavyweight containers in the Swing library. The lightweight container
! * <code>JInternalFrame</code> is also shown.
* All five of these JFC/Swing containers implement the
! * <code>RootPaneContainer</code> interface,
* and they all delegate their operations to a
! * <code>JRootPane</code> (shown with a little "handle" on top).
* <blockquote>
! * <b>Note:</b> The <code>JComponent</code> method <code>getRootPane</code>
! * can be used to obtain the <code>JRootPane</code> that contains
* a given component.
* </blockquote>
* <table style="float:right" border="0" summary="layout">
* <tr>
* <td align="center">
* <img src="doc-files/JRootPane-2.gif"
* alt="The following text describes this graphic." HEIGHT=386 WIDTH=349>
* </td>
* </tr>
* </table>
! * The diagram at right shows the structure of a <code>JRootPane</code>.
! * A <code>JRootpane</code> is made up of a <code>glassPane</code>,
! * an optional <code>menuBar</code>, and a <code>contentPane</code>.
! * (The <code>JLayeredPane</code> manages the <code>menuBar</code>
! * and the <code>contentPane</code>.)
! * The <code>glassPane</code> sits over the top of everything,
* where it is in a position to intercept mouse movements.
! * Since the <code>glassPane</code> (like the <code>contentPane</code>)
* can be an arbitrary component, it is also possible to set up the
! * <code>glassPane</code> for drawing. Lines and images on the
! * <code>glassPane</code> can then range
* over the frames underneath without being limited by their boundaries.
* <p>
! * Although the <code>menuBar</code> component is optional,
! * the <code>layeredPane</code>, <code>contentPane</code>,
! * and <code>glassPane</code> always exist.
! * Attempting to set them to <code>null</code> generates an exception.
* <p>
! * To add components to the <code>JRootPane</code> (other than the
! * optional menu bar), you add the object to the <code>contentPane</code>
! * of the <code>JRootPane</code>, like this:
* <pre>
* rootPane.getContentPane().add(child);
* </pre>
* The same principle holds true for setting layout managers, removing
* components, listing children, etc. All these methods are invoked on
! * the <code>contentPane</code> instead of on the <code>JRootPane</code>.
* <blockquote>
! * <b>Note:</b> The default layout manager for the <code>contentPane</code> is
! * a <code>BorderLayout</code> manager. However, the <code>JRootPane</code>
! * uses a custom <code>LayoutManager</code>.
* So, when you want to change the layout manager for the components you added
! * to a <code>JRootPane</code>, be sure to use code like this:
* <pre>
* rootPane.getContentPane().setLayout(new BoxLayout());
* </pre></blockquote>
! * If a <code>JMenuBar</code> component is set on the <code>JRootPane</code>,
* it is positioned along the upper edge of the frame.
! * The <code>contentPane</code> is adjusted in location and size to
* fill the remaining area.
! * (The <code>JMenuBar</code> and the <code>contentPane</code> are added to the
! * <code>layeredPane</code> component at the
! * <code>JLayeredPane.FRAME_CONTENT_LAYER</code> layer.)
* <p>
! * The <code>layeredPane</code> is the parent of all children in the
! * <code>JRootPane</code> -- both as the direct parent of the menu and
! * the grandparent of all components added to the <code>contentPane</code>.
! * It is an instance of <code>JLayeredPane</code>,
* 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.
* <p>
! * The <code>glassPane</code> sits on top of all other components in the
! * <code>JRootPane</code>.
* 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 use <code>setVisible</code> on the <code>glassPane</code>
! * to control when the <code>glassPane</code> displays over the other children.
! * By default the <code>glassPane</code> is not visible.
* <p>
! * The custom <code>LayoutManager</code> used by <code>JRootPane</code>
* ensures that:
* <OL>
! * <LI>The <code>glassPane</code> fills the entire viewable
! * area of the <code>JRootPane</code> (bounds - insets).
! * <LI>The <code>layeredPane</code> fills the entire viewable area of the
! * <code>JRootPane</code>. (bounds - insets)
! * <LI>The <code>menuBar</code> is positioned at the upper edge of the
! * <code>layeredPane</code>.
! * <LI>The <code>contentPane</code> fills the entire viewable area,
! * minus the <code>menuBar</code>, if present.
* </OL>
! * Any other views in the <code>JRootPane</code> view hierarchy are ignored.
* <p>
! * If you replace the <code>LayoutManager</code> of the <code>JRootPane</code>,
* you are responsible for managing all of these views.
* So ordinarily you will want to be sure that you
! * change the layout manager for the <code>contentPane</code> rather than
! * for the <code>JRootPane</code> itself!
* <p>
* The painting architecture of Swing requires an opaque
! * <code>JComponent</code>
* to 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 of <code>setOpaque(true)</code>. Additionally, if the content pane
! * overrides <code>paintComponent</code>, it
* will need to completely fill in the background in an opaque color in
! * <code>paintComponent</code>.
* <p>
* <strong>Warning:</strong> Swing is not thread safe. For more
* information see <a
* href="package-summary.html#threading">Swing's Threading
* Policy</a>.
--- 52,175 ----
* <p style="text-align:center"><img src="doc-files/JRootPane-1.gif"
* alt="The following text describes this graphic."
* HEIGHT=484 WIDTH=629></p>
* 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 ({@code JFrame}, {@code JDialog},
! * {@code JWindow}, and {@code JApplet}) are
* shown in relation to the AWT classes they extend.
* These four components are the
* only heavyweight containers in the Swing library. The lightweight container
! * {@code JInternalFrame} is also shown.
* All five of these JFC/Swing containers implement the
! * {@code RootPaneContainer} interface,
* and they all delegate their operations to a
! * {@code JRootPane} (shown with a little "handle" on top).
* <blockquote>
! * <b>Note:</b> The {@code JComponent} method {@code getRootPane}
! * can be used to obtain the {@code JRootPane} that contains
* a given component.
* </blockquote>
* <table style="float:right" border="0" summary="layout">
* <tr>
* <td align="center">
* <img src="doc-files/JRootPane-2.gif"
* alt="The following text describes this graphic." HEIGHT=386 WIDTH=349>
* </td>
* </tr>
* </table>
! * The diagram at right shows the structure of a {@code JRootPane}.
! * A {@code JRootpane} is made up of a {@code glassPane},
! * an optional {@code menuBar}, and a {@code contentPane}.
! * (The {@code JLayeredPane} manages the {@code menuBar}
! * and the {@code contentPane}.)
! * The {@code glassPane} sits over the top of everything,
* where it is in a position to intercept mouse movements.
! * Since the {@code glassPane} (like the {@code contentPane})
* can be an arbitrary component, it is also possible to set up the
! * {@code glassPane} for drawing. Lines and images on the
! * {@code glassPane} can then range
* over the frames underneath without being limited by their boundaries.
* <p>
! * Although the {@code menuBar} component is optional,
! * the {@code layeredPane}, {@code contentPane},
! * and {@code glassPane} always exist.
! * Attempting to set them to {@code null} generates an exception.
* <p>
! * To add components to the {@code JRootPane} (other than the
! * optional menu bar), you add the object to the {@code contentPane}
! * of the {@code JRootPane}, like this:
* <pre>
* rootPane.getContentPane().add(child);
* </pre>
* The same principle holds true for setting layout managers, removing
* components, listing children, etc. All these methods are invoked on
! * the {@code contentPane} instead of on the {@code JRootPane}.
* <blockquote>
! * <b>Note:</b> The default layout manager for the {@code contentPane} is
! * a {@code BorderLayout} manager. However, the {@code JRootPane}
! * uses a custom {@code LayoutManager}.
* So, when you want to change the layout manager for the components you added
! * to a {@code JRootPane}, be sure to use code like this:
* <pre>
* rootPane.getContentPane().setLayout(new BoxLayout());
* </pre></blockquote>
! * If a {@code JMenuBar} component is set on the {@code JRootPane},
* it is positioned along the upper edge of the frame.
! * The {@code contentPane} is adjusted in location and size to
* fill the remaining area.
! * (The {@code JMenuBar} and the {@code contentPane} are added to the
! * {@code layeredPane} component at the
! * {@code JLayeredPane.FRAME_CONTENT_LAYER} layer.)
* <p>
! * The {@code layeredPane} is the parent of all children in the
! * {@code JRootPane} -- both as the direct parent of the menu and
! * the grandparent of all components added to the {@code contentPane}.
! * It is an instance of {@code JLayeredPane},
* 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.
* <p>
! * The {@code glassPane} sits on top of all other components in the
! * {@code JRootPane}.
* 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 use {@code setVisible} on the {@code glassPane}
! * to control when the {@code glassPane} displays over the other children.
! * By default the {@code glassPane} is not visible.
* <p>
! * The custom {@code LayoutManager} used by {@code JRootPane}
* ensures that:
* <OL>
! * <LI>The {@code glassPane} fills the entire viewable
! * area of the {@code JRootPane} (bounds - insets).
! * <LI>The {@code layeredPane} fills the entire viewable area of the
! * {@code JRootPane}. (bounds - insets)
! * <LI>The {@code menuBar} is positioned at the upper edge of the
! * {@code layeredPane}.
! * <LI>The {@code contentPane} fills the entire viewable area,
! * minus the {@code menuBar}, if present.
* </OL>
! * Any other views in the {@code JRootPane} view hierarchy are ignored.
* <p>
! * If you replace the {@code LayoutManager} of the {@code JRootPane},
* you are responsible for managing all of these views.
* So ordinarily you will want to be sure that you
! * change the layout manager for the {@code contentPane} rather than
! * for the {@code JRootPane} itself!
* <p>
* The painting architecture of Swing requires an opaque
! * {@code JComponent}
* to 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 of {@code setOpaque(true)}. Additionally, if the content pane
! * overrides {@code paintComponent}, it
* will need to completely fill in the background in an opaque color in
! * {@code paintComponent}.
* <p>
* <strong>Warning:</strong> Swing is not thread safe. For more
* information see <a
* href="package-summary.html#threading">Swing's Threading
* Policy</a>.
*** 178,188 ****
* 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 <code>java.beans</code> package.
* Please see {@link java.beans.XMLEncoder}.
*
* @see JLayeredPane
* @see JMenuBar
* @see JWindow
--- 178,188 ----
* 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 {@code java.beans} package.
* Please see {@link java.beans.XMLEncoder}.
*
* @see JLayeredPane
* @see JMenuBar
* @see JWindow
*** 217,299 ****
*/
private static final boolean IGNORE_DISABLE_TRUE_DOUBLE_BUFFERING;
/**
* Constant used for the windowDecorationStyle property. Indicates that
! * the <code>JRootPane</code> should not provide any sort of
* Window decorations.
*
* @since 1.4
*/
public static final int NONE = 0;
/**
* Constant used for the windowDecorationStyle property. Indicates that
! * the <code>JRootPane</code> should provide decorations appropriate for
* a Frame.
*
* @since 1.4
*/
public static final int FRAME = 1;
/**
* Constant used for the windowDecorationStyle property. Indicates that
! * the <code>JRootPane</code> should provide decorations appropriate for
* a Dialog.
*
* @since 1.4
*/
public static final int PLAIN_DIALOG = 2;
/**
* Constant used for the windowDecorationStyle property. Indicates that
! * the <code>JRootPane</code> should provide decorations appropriate for
* a Dialog used to display an informational message.
*
* @since 1.4
*/
public static final int INFORMATION_DIALOG = 3;
/**
* Constant used for the windowDecorationStyle property. Indicates that
! * the <code>JRootPane</code> should provide decorations appropriate for
* a Dialog used to display an error message.
*
* @since 1.4
*/
public static final int ERROR_DIALOG = 4;
/**
* Constant used for the windowDecorationStyle property. Indicates that
! * the <code>JRootPane</code> should provide decorations appropriate for
! * a Dialog used to display a <code>JColorChooser</code>.
*
* @since 1.4
*/
public static final int COLOR_CHOOSER_DIALOG = 5;
/**
* Constant used for the windowDecorationStyle property. Indicates that
! * the <code>JRootPane</code> should provide decorations appropriate for
! * a Dialog used to display a <code>JFileChooser</code>.
*
* @since 1.4
*/
public static final int FILE_CHOOSER_DIALOG = 6;
/**
* Constant used for the windowDecorationStyle property. Indicates that
! * the <code>JRootPane</code> should provide decorations appropriate for
* a Dialog used to present a question to the user.
*
* @since 1.4
*/
public static final int QUESTION_DIALOG = 7;
/**
* Constant used for the windowDecorationStyle property. Indicates that
! * the <code>JRootPane</code> should provide decorations appropriate for
* a Dialog used to display a warning message.
*
* @since 1.4
*/
public static final int WARNING_DIALOG = 8;
--- 217,299 ----
*/
private static final boolean IGNORE_DISABLE_TRUE_DOUBLE_BUFFERING;
/**
* Constant used for the windowDecorationStyle property. Indicates that
! * the {@code JRootPane} should not provide any sort of
* Window decorations.
*
* @since 1.4
*/
public static final int NONE = 0;
/**
* Constant used for the windowDecorationStyle property. Indicates that
! * the {@code JRootPane} should provide decorations appropriate for
* a Frame.
*
* @since 1.4
*/
public static final int FRAME = 1;
/**
* Constant used for the windowDecorationStyle property. Indicates that
! * the {@code JRootPane} should provide decorations appropriate for
* a Dialog.
*
* @since 1.4
*/
public static final int PLAIN_DIALOG = 2;
/**
* Constant used for the windowDecorationStyle property. Indicates that
! * the {@code JRootPane} should provide decorations appropriate for
* a Dialog used to display an informational message.
*
* @since 1.4
*/
public static final int INFORMATION_DIALOG = 3;
/**
* Constant used for the windowDecorationStyle property. Indicates that
! * the {@code JRootPane} should provide decorations appropriate for
* a Dialog used to display an error message.
*
* @since 1.4
*/
public static final int ERROR_DIALOG = 4;
/**
* Constant used for the windowDecorationStyle property. Indicates that
! * the {@code JRootPane} should provide decorations appropriate for
! * a Dialog used to display a {@code JColorChooser}.
*
* @since 1.4
*/
public static final int COLOR_CHOOSER_DIALOG = 5;
/**
* Constant used for the windowDecorationStyle property. Indicates that
! * the {@code JRootPane} should provide decorations appropriate for
! * a Dialog used to display a {@code JFileChooser}.
*
* @since 1.4
*/
public static final int FILE_CHOOSER_DIALOG = 6;
/**
* Constant used for the windowDecorationStyle property. Indicates that
! * the {@code JRootPane} should provide decorations appropriate for
* a Dialog used to present a question to the user.
*
* @since 1.4
*/
public static final int QUESTION_DIALOG = 7;
/**
* Constant used for the windowDecorationStyle property. Indicates that
! * the {@code JRootPane} should provide decorations appropriate for
* a Dialog used to display a warning message.
*
* @since 1.4
*/
public static final int WARNING_DIALOG = 8;
*** 319,341 ****
* a UI-specific action like pressing the <b>Enter</b> key occurs.
*/
protected JButton defaultButton;
/**
* As of Java 2 platform v1.3 this unusable field is no longer used.
! * To override the default button you should replace the <code>Action</code>
! * in the <code>JRootPane</code>'s <code>ActionMap</code>. Please refer to
* the key bindings specification for further details.
*
* @deprecated As of Java 2 platform v1.3.
* @see #defaultButton
*/
@Deprecated
protected DefaultAction defaultPressAction;
/**
* As of Java 2 platform v1.3 this unusable field is no longer used.
! * To override the default button you should replace the <code>Action</code>
! * in the <code>JRootPane</code>'s <code>ActionMap</code>. Please refer to
* the key bindings specification for further details.
*
* @deprecated As of Java 2 platform v1.3.
* @see #defaultButton
*/
--- 319,341 ----
* a UI-specific action like pressing the <b>Enter</b> key occurs.
*/
protected JButton defaultButton;
/**
* As of Java 2 platform v1.3 this unusable field is no longer used.
! * To override the default button you should replace the {@code Action}
! * in the {@code JRootPane}'s {@code ActionMap}. Please refer to
* the key bindings specification for further details.
*
* @deprecated As of Java 2 platform v1.3.
* @see #defaultButton
*/
@Deprecated
protected DefaultAction defaultPressAction;
/**
* As of Java 2 platform v1.3 this unusable field is no longer used.
! * To override the default button you should replace the {@code Action}
! * in the {@code JRootPane}'s {@code ActionMap}. Please refer to
* the key bindings specification for further details.
*
* @deprecated As of Java 2 platform v1.3.
* @see #defaultButton
*/
*** 357,369 ****
AccessController.doPrivileged(new GetBooleanAction(
"swing.ignoreDoubleBufferingDisable"));
}
/**
! * Creates a <code>JRootPane</code>, setting up its
! * <code>glassPane</code>, <code>layeredPane</code>,
! * and <code>contentPane</code>.
*/
public JRootPane() {
setGlassPane(createGlassPane());
setLayeredPane(createLayeredPane());
setContentPane(createContentPane());
--- 357,369 ----
AccessController.doPrivileged(new GetBooleanAction(
"swing.ignoreDoubleBufferingDisable"));
}
/**
! * Creates a {@code JRootPane}, setting up its
! * {@code glassPane}, {@code layeredPane},
! * and {@code contentPane}.
*/
public JRootPane() {
setGlassPane(createGlassPane());
setLayeredPane(createLayeredPane());
setContentPane(createContentPane());
*** 383,427 ****
}
}
/**
* Returns a constant identifying the type of Window decorations the
! * <code>JRootPane</code> is providing.
*
! * @return One of <code>NONE</code>, <code>FRAME</code>,
! * <code>PLAIN_DIALOG</code>, <code>INFORMATION_DIALOG</code>,
! * <code>ERROR_DIALOG</code>, <code>COLOR_CHOOSER_DIALOG</code>,
! * <code>FILE_CHOOSER_DIALOG</code>, <code>QUESTION_DIALOG</code> or
! * <code>WARNING_DIALOG</code>.
* @see #setWindowDecorationStyle
* @since 1.4
*/
public int getWindowDecorationStyle() {
return windowDecorationStyle;
}
/**
* Sets the type of Window decorations (such as borders, widgets for
! * closing a Window, title ...) the <code>JRootPane</code> should
* provide. The default is to provide no Window decorations
! * (<code>NONE</code>).
* <p>
* This is only a hint, and some look and feels may not support
* this.
* This is a bound property.
*
* @param windowDecorationStyle Constant identifying Window decorations
* to provide.
* @see JDialog#setDefaultLookAndFeelDecorated
* @see JFrame#setDefaultLookAndFeelDecorated
* @see LookAndFeel#getSupportsWindowDecorations
! * @throws IllegalArgumentException if <code>style</code> is
! * not one of: <code>NONE</code>, <code>FRAME</code>,
! * <code>PLAIN_DIALOG</code>, <code>INFORMATION_DIALOG</code>,
! * <code>ERROR_DIALOG</code>, <code>COLOR_CHOOSER_DIALOG</code>,
! * <code>FILE_CHOOSER_DIALOG</code>, <code>QUESTION_DIALOG</code>, or
! * <code>WARNING_DIALOG</code>.
* @since 1.4
* @beaninfo
* bound: true
* enum: NONE JRootPane.NONE
* FRAME JRootPane.FRAME
--- 383,427 ----
}
}
/**
* Returns a constant identifying the type of Window decorations the
! * {@code JRootPane} is providing.
*
! * @return One of {@code NONE}, {@code FRAME},
! * {@code PLAIN_DIALOG}, {@code INFORMATION_DIALOG},
! * {@code ERROR_DIALOG}, {@code COLOR_CHOOSER_DIALOG},
! * {@code FILE_CHOOSER_DIALOG}, {@code QUESTION_DIALOG} or
! * {@code WARNING_DIALOG}.
* @see #setWindowDecorationStyle
* @since 1.4
*/
public int getWindowDecorationStyle() {
return windowDecorationStyle;
}
/**
* Sets the type of Window decorations (such as borders, widgets for
! * closing a Window, title ...) the {@code JRootPane} should
* provide. The default is to provide no Window decorations
! * ({@code NONE}).
* <p>
* This is only a hint, and some look and feels may not support
* this.
* This is a bound property.
*
* @param windowDecorationStyle Constant identifying Window decorations
* to provide.
* @see JDialog#setDefaultLookAndFeelDecorated
* @see JFrame#setDefaultLookAndFeelDecorated
* @see LookAndFeel#getSupportsWindowDecorations
! * @throws IllegalArgumentException if {@code style} is
! * not one of: {@code NONE}, {@code FRAME},
! * {@code PLAIN_DIALOG}, {@code INFORMATION_DIALOG},
! * {@code ERROR_DIALOG}, {@code COLOR_CHOOSER_DIALOG},
! * {@code FILE_CHOOSER_DIALOG}, {@code QUESTION_DIALOG}, or
! * {@code WARNING_DIALOG}.
* @since 1.4
* @beaninfo
* bound: true
* enum: NONE JRootPane.NONE
* FRAME JRootPane.FRAME
*** 449,469 ****
}
/**
* Returns the L&F object that renders this component.
*
! * @return <code>LabelUI</code> object
* @since 1.3
*/
public RootPaneUI getUI() {
return (RootPaneUI)ui;
}
/**
* Sets the L&F object that renders this component.
*
! * @param ui the <code>LabelUI</code> L&F object
* @see UIDefaults#getUI
* @beaninfo
* bound: true
* hidden: true
* expert: true
--- 449,469 ----
}
/**
* Returns the L&F object that renders this component.
*
! * @return {@code LabelUI} object
* @since 1.3
*/
public RootPaneUI getUI() {
return (RootPaneUI)ui;
}
/**
* Sets the L&F object that renders this component.
*
! * @param ui the {@code LabelUI} L&F object
* @see UIDefaults#getUI
* @beaninfo
* bound: true
* hidden: true
* expert: true
*** 499,524 ****
return uiClassID;
}
/**
* Called by the constructor methods to create the default
! * <code>layeredPane</code>.
! * Bt default it creates a new <code>JLayeredPane</code>.
! * @return the default <code>layeredPane</code>
*/
protected JLayeredPane createLayeredPane() {
JLayeredPane p = new JLayeredPane();
p.setName(this.getName()+".layeredPane");
return p;
}
/**
* Called by the constructor methods to create the default
! * <code>contentPane</code>.
! * By default this method creates a new <code>JComponent</code> add sets a
! * <code>BorderLayout</code> as its <code>LayoutManager</code>.
! * @return the default <code>contentPane</code>
*/
protected Container createContentPane() {
JComponent c = new JPanel();
c.setName(this.getName()+".contentPane");
c.setLayout(new BorderLayout() {
--- 499,524 ----
return uiClassID;
}
/**
* Called by the constructor methods to create the default
! * {@code layeredPane}.
! * Bt default it creates a new {@code JLayeredPane}.
! * @return the default {@code layeredPane}
*/
protected JLayeredPane createLayeredPane() {
JLayeredPane p = new JLayeredPane();
p.setName(this.getName()+".layeredPane");
return p;
}
/**
* Called by the constructor methods to create the default
! * {@code contentPane}.
! * By default this method creates a new {@code JComponent} add sets a
! * {@code BorderLayout} as its {@code LayoutManager}.
! * @return the default {@code contentPane}
*/
protected Container createContentPane() {
JComponent c = new JPanel();
c.setName(this.getName()+".contentPane");
c.setLayout(new BorderLayout() {
*** 536,549 ****
return c;
}
/**
* Called by the constructor methods to create the default
! * <code>glassPane</code>.
! * By default this method creates a new <code>JComponent</code>
* with visibility set to false.
! * @return the default <code>glassPane</code>
*/
protected Component createGlassPane() {
JComponent c = new JPanel();
c.setName(this.getName()+".glassPane");
c.setVisible(false);
--- 536,549 ----
return c;
}
/**
* Called by the constructor methods to create the default
! * {@code glassPane}.
! * By default this method creates a new {@code JComponent}
* with visibility set to false.
! * @return the default {@code glassPane}
*/
protected Component createGlassPane() {
JComponent c = new JPanel();
c.setName(this.getName()+".glassPane");
c.setVisible(false);
*** 551,570 ****
return c;
}
/**
* Called by the constructor methods to create the default
! * <code>layoutManager</code>.
! * @return the default <code>layoutManager</code>.
*/
protected LayoutManager createRootLayout() {
return new RootLayout();
}
/**
* Adds or changes the menu bar used in the layered pane.
! * @param menu the <code>JMenuBar</code> to add
*/
public void setJMenuBar(JMenuBar menu) {
if(menuBar != null && menuBar.getParent() == layeredPane)
layeredPane.remove(menuBar);
menuBar = menu;
--- 551,570 ----
return c;
}
/**
* Called by the constructor methods to create the default
! * {@code layoutManager}.
! * @return the default {@code layoutManager}.
*/
protected LayoutManager createRootLayout() {
return new RootLayout();
}
/**
* Adds or changes the menu bar used in the layered pane.
! * @param menu the {@code JMenuBar} to add
*/
public void setJMenuBar(JMenuBar menu) {
if(menuBar != null && menuBar.getParent() == layeredPane)
layeredPane.remove(menuBar);
menuBar = menu;
*** 574,585 ****
}
/**
* Specifies the menu bar value.
* @deprecated As of Swing version 1.0.3
! * replaced by <code>setJMenuBar(JMenuBar menu)</code>.
! * @param menu the <code>JMenuBar</code> to add.
*/
@Deprecated
public void setMenuBar(JMenuBar menu){
if(menuBar != null && menuBar.getParent() == layeredPane)
layeredPane.remove(menuBar);
--- 574,585 ----
}
/**
* Specifies the menu bar value.
* @deprecated As of Swing version 1.0.3
! * replaced by {@code setJMenuBar(JMenuBar menu)}.
! * @param menu the {@code JMenuBar} to add.
*/
@Deprecated
public void setMenuBar(JMenuBar menu){
if(menuBar != null && menuBar.getParent() == layeredPane)
layeredPane.remove(menuBar);
*** 589,623 ****
layeredPane.add(menuBar, JLayeredPane.FRAME_CONTENT_LAYER);
}
/**
* Returns the menu bar from the layered pane.
! * @return the <code>JMenuBar</code> used in the pane
*/
public JMenuBar getJMenuBar() { return menuBar; }
/**
* Returns the menu bar value.
* @deprecated As of Swing version 1.0.3
! * replaced by <code>getJMenuBar()</code>.
! * @return the <code>JMenuBar</code> used in the pane
*/
@Deprecated
public JMenuBar getMenuBar() { return menuBar; }
/**
* Sets the content pane -- the container that holds the components
* parented by the root pane.
* <p>
! * Swing's painting architecture requires an opaque <code>JComponent</code>
* in 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 opaque <code>JComponent</code>.
*
! * @param content the <code>Container</code> to use for component-contents
* @exception java.awt.IllegalComponentStateException (a runtime
! * exception) if the content pane parameter is <code>null</code>
*/
public void setContentPane(Container content) {
if(content == null)
throw new IllegalComponentStateException("contentPane cannot be set to null.");
if(contentPane != null && contentPane.getParent() == layeredPane)
--- 589,623 ----
layeredPane.add(menuBar, JLayeredPane.FRAME_CONTENT_LAYER);
}
/**
* Returns the menu bar from the layered pane.
! * @return the {@code JMenuBar} used in the pane
*/
public JMenuBar getJMenuBar() { return menuBar; }
/**
* Returns the menu bar value.
* @deprecated As of Swing version 1.0.3
! * replaced by {@code getJMenuBar()}.
! * @return the {@code JMenuBar} used in the pane
*/
@Deprecated
public JMenuBar getMenuBar() { return menuBar; }
/**
* Sets the content pane -- the container that holds the components
* parented by the root pane.
* <p>
! * Swing's painting architecture requires an opaque {@code JComponent}
* in 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 opaque {@code JComponent}.
*
! * @param content the {@code Container} to use for component-contents
* @exception java.awt.IllegalComponentStateException (a runtime
! * exception) if the content pane parameter is {@code null}
*/
public void setContentPane(Container content) {
if(content == null)
throw new IllegalComponentStateException("contentPane cannot be set to null.");
if(contentPane != null && contentPane.getParent() == layeredPane)
*** 629,650 ****
/**
* Returns the content pane -- the container that holds the components
* parented by the root pane.
*
! * @return the <code>Container</code> that holds the component-contents
*/
public Container getContentPane() { return contentPane; }
// PENDING(klobad) Should this reparent the contentPane and MenuBar?
/**
* Sets the layered pane for the root pane. The layered pane
! * typically holds a content pane and an optional <code>JMenuBar</code>.
*
! * @param layered the <code>JLayeredPane</code> to use
* @exception java.awt.IllegalComponentStateException (a runtime
! * exception) if the layered pane parameter is <code>null</code>
*/
public void setLayeredPane(JLayeredPane layered) {
if(layered == null)
throw new IllegalComponentStateException("layeredPane cannot be set to null.");
if(layeredPane != null && layeredPane.getParent() == this)
--- 629,650 ----
/**
* Returns the content pane -- the container that holds the components
* parented by the root pane.
*
! * @return the {@code Container} that holds the component-contents
*/
public Container getContentPane() { return contentPane; }
// PENDING(klobad) Should this reparent the contentPane and MenuBar?
/**
* Sets the layered pane for the root pane. The layered pane
! * typically holds a content pane and an optional {@code JMenuBar}.
*
! * @param layered the {@code JLayeredPane} to use
* @exception java.awt.IllegalComponentStateException (a runtime
! * exception) if the layered pane parameter is {@code null}
*/
public void setLayeredPane(JLayeredPane layered) {
if(layered == null)
throw new IllegalComponentStateException("layeredPane cannot be set to null.");
if(layeredPane != null && layeredPane.getParent() == this)
*** 653,670 ****
this.add(layeredPane, -1);
}
/**
* Gets the layered pane used by the root pane. The layered pane
! * typically holds a content pane and an optional <code>JMenuBar</code>.
*
! * @return the <code>JLayeredPane</code> currently in use
*/
public JLayeredPane getLayeredPane() { return layeredPane; }
/**
! * Sets a specified <code>Component</code> 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.
* <p>
* The new glass pane's visibility is changed to match that of
--- 653,670 ----
this.add(layeredPane, -1);
}
/**
* Gets the layered pane used by the root pane. The layered pane
! * typically holds a content pane and an optional {@code JMenuBar}.
*
! * @return the {@code JLayeredPane} currently in use
*/
public JLayeredPane getLayeredPane() { return layeredPane; }
/**
! * Sets a specified {@code 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.
* <p>
* The new glass pane's visibility is changed to match that of
*** 679,692 ****
* <pre>
* root.getGlassPane().setVisible(true);
* root.setGlassPane(newGlassPane);
* </pre>
*
! * @param glass the <code>Component</code> to use as the glass pane
! * for this <code>JRootPane</code>
! * @exception NullPointerException if the <code>glass</code> parameter is
! * <code>null</code>
*/
public void setGlassPane(Component glass) {
if (glass == null) {
throw new NullPointerException("glassPane cannot be set to null.");
}
--- 679,692 ----
* <pre>
* root.getGlassPane().setVisible(true);
* root.setGlassPane(newGlassPane);
* </pre>
*
! * @param glass the {@code Component} to use as the glass pane
! * for this {@code JRootPane}
! * @exception NullPointerException if the {@code glass} parameter is
! * {@code null}
*/
public void setGlassPane(Component glass) {
if (glass == null) {
throw new NullPointerException("glassPane cannot be set to null.");
}
*** 707,732 ****
repaint();
}
}
/**
! * Returns the current glass pane for this <code>JRootPane</code>.
* @return the current glass pane
* @see #setGlassPane
*/
public Component getGlassPane() {
return glassPane;
}
/**
! * If a descendant of this <code>JRootPane</code> calls
! * <code>revalidate</code>, validate from here on down.
*<p>
* Deferred requests to layout a component and its descendents again.
! * For example, calls to <code>revalidate</code>, are pushed upwards to
! * either a <code>JRootPane</code> or a <code>JScrollPane</code>
! * because both classes override <code>isValidateRoot</code> to return true.
*
* @see JComponent#isValidateRoot
* @see java.awt.Container#isValidateRoot
* @return true
*/
--- 707,732 ----
repaint();
}
}
/**
! * Returns the current glass pane for this {@code JRootPane}.
* @return the current glass pane
* @see #setGlassPane
*/
public Component getGlassPane() {
return glassPane;
}
/**
! * If a descendant of this {@code JRootPane} calls
! * {@code revalidate}, validate from here on down.
*<p>
* Deferred requests to layout a component and its descendents again.
! * For example, calls to {@code revalidate}, are pushed upwards to
! * either a {@code JRootPane} or a {@code JScrollPane}
! * because both classes override {@code isValidateRoot} to return true.
*
* @see JComponent#isValidateRoot
* @see java.awt.Container#isValidateRoot
* @return true
*/
*** 734,751 ****
public boolean isValidateRoot() {
return true;
}
/**
! * The <code>glassPane</code> and <code>contentPane</code>
! * have the same bounds, which means <code>JRootPane</code>
* does not tiles its children and this should return false.
! * On the other hand, the <code>glassPane</code>
* is normally not visible, and so this can return true if the
! * <code>glassPane</code> isn't visible. Therefore, the
* return value here depends upon the visibility of the
! * <code>glassPane</code>.
*
* @return true if this component's children don't overlap
*/
public boolean isOptimizedDrawingEnabled() {
return !glassPane.isVisible();
--- 734,751 ----
public boolean isValidateRoot() {
return true;
}
/**
! * The {@code glassPane} and {@code contentPane}
! * have the same bounds, which means {@code JRootPane}
* does not tiles its children and this should return false.
! * On the other hand, the {@code glassPane}
* is normally not visible, and so this can return true if the
! * {@code glassPane} isn't visible. Therefore, the
* return value here depends upon the visibility of the
! * {@code glassPane}.
*
* @return true if this component's children don't overlap
*/
public boolean isOptimizedDrawingEnabled() {
return !glassPane.isVisible();
*** 766,790 ****
super.removeNotify();
}
/**
! * Sets the <code>defaultButton</code> property,
! * which determines the current default button for this <code>JRootPane</code>.
* The default button is the button which will be activated
* when a UI-defined activation event (typically the <b>Enter</b> 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 <code>JTextPane</code>).
* 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 <code>null</code>.
*
* @see JButton#isDefaultButton
! * @param defaultButton the <code>JButton</code> which is to be the default button
*
* @beaninfo
* description: The button activated by default in this root pane
*/
public void setDefaultButton(JButton defaultButton) {
--- 766,790 ----
super.removeNotify();
}
/**
! * Sets the {@code defaultButton} property,
! * which determines the current default button for this {@code JRootPane}.
* The default button is the button which will be activated
* when a UI-defined activation event (typically the <b>Enter</b> 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 {@code 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 {@code null}.
*
* @see JButton#isDefaultButton
! * @param defaultButton the {@code JButton} which is to be the default button
*
* @beaninfo
* description: The button activated by default in this root pane
*/
public void setDefaultButton(JButton defaultButton) {
*** 803,814 ****
firePropertyChange("defaultButton", oldDefault, defaultButton);
}
/**
! * Returns the value of the <code>defaultButton</code> property.
! * @return the <code>JButton</code> which is currently the default button
* @see #setDefaultButton
*/
public JButton getDefaultButton() {
return defaultButton;
}
--- 803,814 ----
firePropertyChange("defaultButton", oldDefault, defaultButton);
}
/**
! * Returns the value of the {@code defaultButton} property.
! * @return the {@code JButton} which is currently the default button
* @see #setDefaultButton
*/
public JButton getDefaultButton() {
return defaultButton;
}
*** 898,908 ****
* 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 <code>java.beans</code> package.
* Please see {@link java.beans.XMLEncoder}.
*/
@SuppressWarnings("serial")
protected class RootLayout implements LayoutManager2, Serializable
{
--- 898,908 ----
* 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 {@code java.beans} package.
* Please see {@link java.beans.XMLEncoder}.
*/
@SuppressWarnings("serial")
protected class RootLayout implements LayoutManager2, Serializable
{
*** 1020,1074 ****
public float getLayoutAlignmentY(Container target) { return 0.0f; }
public void invalidateLayout(Container target) {}
}
/**
! * Returns a string representation of this <code>JRootPane</code>.
* 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 <code>null</code>.
*
! * @return a string representation of this <code>JRootPane</code>.
*/
protected String paramString() {
return super.paramString();
}
/////////////////
// Accessibility support
////////////////
/**
! * Gets the <code>AccessibleContext</code> associated with this
! * <code>JRootPane</code>. For root panes, the
! * <code>AccessibleContext</code> takes the form of an
! * <code>AccessibleJRootPane</code>.
! * A new <code>AccessibleJRootPane</code> instance is created if necessary.
*
! * @return an <code>AccessibleJRootPane</code> that serves as the
! * <code>AccessibleContext</code> of this <code>JRootPane</code>
*/
public AccessibleContext getAccessibleContext() {
if (accessibleContext == null) {
accessibleContext = new AccessibleJRootPane();
}
return accessibleContext;
}
/**
* This class implements accessibility support for the
! * <code>JRootPane</code> class. It provides an implementation of the
* Java Accessibility API appropriate to root pane user-interface elements.
* <p>
* <strong>Warning:</strong>
* 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 <code>java.beans</code> package.
* Please see {@link java.beans.XMLEncoder}.
*/
@SuppressWarnings("serial")
protected class AccessibleJRootPane extends AccessibleJComponent {
/**
--- 1020,1074 ----
public float getLayoutAlignmentY(Container target) { return 0.0f; }
public void invalidateLayout(Container target) {}
}
/**
! * Returns a string representation of this {@code 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 {@code null}.
*
! * @return a string representation of this {@code JRootPane}.
*/
protected String paramString() {
return super.paramString();
}
/////////////////
// Accessibility support
////////////////
/**
! * Gets the {@code AccessibleContext} associated with this
! * {@code JRootPane}. For root panes, the
! * {@code AccessibleContext} takes the form of an
! * {@code AccessibleJRootPane}.
! * A new {@code AccessibleJRootPane} instance is created if necessary.
*
! * @return an {@code AccessibleJRootPane} that serves as the
! * {@code AccessibleContext} of this {@code JRootPane}
*/
public AccessibleContext getAccessibleContext() {
if (accessibleContext == null) {
accessibleContext = new AccessibleJRootPane();
}
return accessibleContext;
}
/**
* This class implements accessibility support for the
! * {@code JRootPane} class. It provides an implementation of the
* Java Accessibility API appropriate to root pane user-interface elements.
* <p>
* <strong>Warning:</strong>
* 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 {@code java.beans} package.
* Please see {@link java.beans.XMLEncoder}.
*/
@SuppressWarnings("serial")
protected class AccessibleJRootPane extends AccessibleJComponent {
/**
< prev index next >