KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > swing > RootPaneContainer


1 /*
2  * @(#)RootPaneContainer.java 1.15 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package javax.swing;
9
10 import java.awt.Component JavaDoc;
11 import java.awt.Container JavaDoc;
12
13
14 /**
15  * This interface is implemented by components that have a single
16  * JRootPane child: JDialog, JFrame, JWindow, JApplet, JInternalFrame.
17  * The methods in this interface are just <i>covers</i> for the JRootPane
18  * properties, e.g. <code>getContentPane()</code> is generally implemented
19  * like this:<pre>
20  * public Container getContentPane() {
21  * return getRootPane().getContentPane();
22  * }
23  * </pre>
24  * This interface serves as a <i>marker</i> for Swing GUI builders
25  * that need to treat components like JFrame, that contain a
26  * single JRootPane, specially. For example in a GUI builder,
27  * dropping a component on a RootPaneContainer would be interpreted
28  * as <code>frame.getContentPane().add(child)</code>.
29  * <p>
30  * For conveniance
31  * <code>JFrame</code>, <code>JDialog</code>, <code>JWindow</code>,
32  * <code>JApplet</code> and <code>JInternalFrame</code>, by default,
33  * forward, by default, all calls to the <code>add</code>,
34  * <code>remove</code> and <code>setLayout</code> methods, to the
35  * <code>contentPane</code>. This means you can call:
36  * <pre>
37  * rootPaneContainer.add(component);
38  * </pre>
39  * instead of:
40  * <pre>
41  * rootPaneContainer.getContentPane().add(component);
42  * </pre>
43  * <p>
44  * The behavior of the <code>add</code> and
45  * <code>setLayout</code> methods for
46  * <code>JFrame</code>, <code>JDialog</code>, <code>JWindow</code>,
47  * <code>JApplet</code> and <code>JInternalFrame</code> is controlled by
48  * the <code>rootPaneCheckingEnabled</code> property. If this property is
49  * true (the default), then calls to these methods are
50   * forwarded to the <code>contentPane</code>; if false, these
51   * methods operate directly on the <code>RootPaneContainer</code>. This
52   * property is only intended for subclasses, and is therefore protected.
53  *
54  * @see JRootPane
55  * @see JFrame
56  * @see JDialog
57  * @see JWindow
58  * @see JApplet
59  * @see JInternalFrame
60  *
61  * @version 1.15 12/19/03
62  * @author Hans Muller
63  */

64 public interface RootPaneContainer
65 {
66     /**
67      * Return this component's single JRootPane child. A conventional
68      * implementation of this interface will have all of the other
69      * methods indirect through this one. The rootPane has two
70      * children: the glassPane and the layeredPane.
71      *
72      * @return this components single JRootPane child.
73      * @see JRootPane
74      */

75     JRootPane JavaDoc getRootPane();
76
77
78     /**
79      * The "contentPane" is the primary container for application
80      * specific components. Applications should add children to
81      * the contentPane, set its layout manager, and so on.
82      * <p>
83      * The contentPane my not be null.
84      * <p>
85      * Generally implemented with
86      * <code>getRootPane().setContentPane(contentPane);</code>
87      *
88      * @exception java.awt.IllegalComponentStateException (a runtime
89      * exception) if the content pane parameter is null
90      * @param contentPane the Container to use for the contents of this
91      * JRootPane
92      * @see JRootPane#getContentPane
93      * @see #getContentPane
94      */

95     void setContentPane(Container JavaDoc contentPane);
96
97
98     /**
99      * Returns the contentPane.
100      *
101      * @return the value of the contentPane property.
102      * @see #setContentPane
103      */

104     Container JavaDoc getContentPane();
105
106
107     /**
108      * A Container that manages the contentPane and in some cases a menu bar.
109      * The layeredPane can be used by descendants that want to add a child
110      * to the RootPaneContainer that isn't layout managed. For example
111      * an internal dialog or a drag and drop effect component.
112      * <p>
113      * The layeredPane may not be null.
114      * <p>
115      * Generally implemented with<pre>
116      * getRootPane().setLayeredPane(layeredPane);</pre>
117      *
118      * @exception java.awt.IllegalComponentStateException (a runtime
119      * exception) if the layered pane parameter is null
120      * @see #getLayeredPane
121      * @see JRootPane#getLayeredPane
122      */

123     void setLayeredPane(JLayeredPane JavaDoc layeredPane);
124
125
126     /**
127      * Returns the layeredPane.
128      *
129      * @return the value of the layeredPane property.
130      * @see #setLayeredPane
131      */

132     JLayeredPane JavaDoc getLayeredPane();
133
134
135     /**
136      * The glassPane is always the first child of the rootPane
137      * and the rootPanes layout manager ensures that it's always
138      * as big as the rootPane. By default it's transparent and
139      * not visible. It can be used to temporarily grab all keyboard
140      * and mouse input by adding listeners and then making it visible.
141      * by default it's not visible.
142      * <p>
143      * The glassPane may not be null.
144      * <p>
145      * Generally implemented with
146      * <code>getRootPane().setGlassPane(glassPane);</code>
147      *
148      * @see #getGlassPane
149      * @see JRootPane#setGlassPane
150      */

151     void setGlassPane(Component JavaDoc glassPane);
152
153
154     /**
155      * Returns the glassPane.
156      *
157      * @return the value of the glassPane property.
158      * @see #setGlassPane
159      */

160     Component JavaDoc getGlassPane();
161
162 }
163
164
Popular Tags