jdk/src/share/classes/javax/swing/RootPaneContainer.java
author malenkov
Mon, 14 Oct 2013 13:22:36 +0400
changeset 21255 0afb44cd0215
parent 5506 202f599c92aa
child 23010 6dadb192ad81
permissions -rw-r--r--
7165112: Incomprehensible garbage in doc for RootPaneContainer Reviewed-by: alexsch
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     2
 * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package javax.swing;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.awt.Component;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.awt.Container;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * This interface is implemented by components that have a single
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * JRootPane child: JDialog, JFrame, JWindow, JApplet, JInternalFrame.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * The methods in  this interface are just <i>covers</i> for the JRootPane
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * properties, e.g. <code>getContentPane()</code> is generally implemented
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * like this:<pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 *     public Container getContentPane() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 *         return getRootPane().getContentPane();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 *     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * This interface serves as a <i>marker</i> for Swing GUI builders
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * that need to treat components like JFrame, that contain a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * single JRootPane, specially.  For example in a GUI builder,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * dropping a component on a RootPaneContainer would be interpreted
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * as <code>frame.getContentPane().add(child)</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * <p>
21255
0afb44cd0215 7165112: Incomprehensible garbage in doc for RootPaneContainer
malenkov
parents: 5506
diff changeset
    48
 * As a convenience, the standard classes that implement this interface
0afb44cd0215 7165112: Incomprehensible garbage in doc for RootPaneContainer
malenkov
parents: 5506
diff changeset
    49
 * (such as {@code JFrame}, {@code JDialog}, {@code JWindow}, {@code JApplet},
0afb44cd0215 7165112: Incomprehensible garbage in doc for RootPaneContainer
malenkov
parents: 5506
diff changeset
    50
 * and {@code JInternalFrame}) have their {@code add}, {@code remove},
0afb44cd0215 7165112: Incomprehensible garbage in doc for RootPaneContainer
malenkov
parents: 5506
diff changeset
    51
 * and {@code setLayout} methods overridden, so that they delegate calls
0afb44cd0215 7165112: Incomprehensible garbage in doc for RootPaneContainer
malenkov
parents: 5506
diff changeset
    52
 * to the corresponding methods of the {@code ContentPane}.
0afb44cd0215 7165112: Incomprehensible garbage in doc for RootPaneContainer
malenkov
parents: 5506
diff changeset
    53
 * For example, you can add a child component to a frame as follows:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 * <pre>
21255
0afb44cd0215 7165112: Incomprehensible garbage in doc for RootPaneContainer
malenkov
parents: 5506
diff changeset
    55
 *       frame.add(child);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 * </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 * instead of:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 * <pre>
21255
0afb44cd0215 7165112: Incomprehensible garbage in doc for RootPaneContainer
malenkov
parents: 5506
diff changeset
    59
 *       frame.getContentPane().add(child);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 * </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
 * The behavior of the <code>add</code> and
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
 * <code>setLayout</code> methods for
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 * <code>JFrame</code>, <code>JDialog</code>, <code>JWindow</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
 * <code>JApplet</code> and <code>JInternalFrame</code> is controlled by
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
 * the <code>rootPaneCheckingEnabled</code> property. If this property is
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
 * true (the default), then calls to these methods are
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
  * forwarded to the <code>contentPane</code>; if false, these
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
  * methods operate directly on the <code>RootPaneContainer</code>. This
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
  * property is only intended for subclasses, and is therefore protected.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
 * @see JRootPane
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
 * @see JFrame
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
 * @see JDialog
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
 * @see JWindow
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
 * @see JApplet
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
 * @see JInternalFrame
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
 * @author Hans Muller
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
public interface RootPaneContainer
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
     * Return this component's single JRootPane child.  A conventional
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
     * implementation of this interface will have all of the other
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
     * methods indirect through this one.  The rootPane has two
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
     * children: the glassPane and the layeredPane.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
     * @return this components single JRootPane child.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
     * @see JRootPane
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
    JRootPane getRootPane();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
     * The "contentPane" is the primary container for application
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
     * specific components.  Applications should add children to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
     * the contentPane, set its layout manager, and so on.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
     * The contentPane may not be null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
     * Generally implemented with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
     * <code>getRootPane().setContentPane(contentPane);</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
     * @exception java.awt.IllegalComponentStateException (a runtime
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
     *            exception) if the content pane parameter is null
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
     * @param contentPane the Container to use for the contents of this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
     *        JRootPane
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
     * @see JRootPane#getContentPane
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
     * @see #getContentPane
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
    void setContentPane(Container contentPane);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
     * Returns the contentPane.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
     * @return the value of the contentPane property.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
     * @see #setContentPane
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
    Container getContentPane();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
     * A Container that manages the contentPane and in some cases a menu bar.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
     * The layeredPane can be used by descendants that want to add a child
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
     * to the RootPaneContainer that isn't layout managed.  For example
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
     * an internal dialog or a drag and drop effect component.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
     * The layeredPane may not be null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
     * Generally implemented with<pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
     *    getRootPane().setLayeredPane(layeredPane);</pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
     * @exception java.awt.IllegalComponentStateException (a runtime
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
     *            exception) if the layered pane parameter is null
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
     * @see #getLayeredPane
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
     * @see JRootPane#getLayeredPane
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
    void setLayeredPane(JLayeredPane layeredPane);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
     * Returns the layeredPane.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
     * @return the value of the layeredPane property.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
     * @see #setLayeredPane
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
    JLayeredPane getLayeredPane();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
     * The glassPane is always the first child of the rootPane
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
     * and the rootPanes layout manager ensures that it's always
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
     * as big as the rootPane.  By default it's transparent and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
     * not visible.  It can be used to temporarily grab all keyboard
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
     * and mouse input by adding listeners and then making it visible.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
     * by default it's not visible.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
     * The glassPane may not be null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
     * Generally implemented with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
     * <code>getRootPane().setGlassPane(glassPane);</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
     * @see #getGlassPane
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
     * @see JRootPane#setGlassPane
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
    void setGlassPane(Component glassPane);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
     * Returns the glassPane.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
     * @return the value of the glassPane property.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
     * @see #setGlassPane
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
    Component getGlassPane();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
}