87
87
protected AccessibleContext accessibleContext;
90
* Tells us if we're in the initialization stage.
91
* If so, adds go to top-level Container, otherwise they go
92
* to the content pane for this container.
90
* Creates a new <code>JWindow</code> that has a shared invisible owner frame
94
private boolean initStageDone = false;
98
super(SwingUtilities.getOwnerFrame());
95
super(SwingUtilities.getOwnerFrame(null));
100
* Creates a new <code>JWindow</code> that uses the specified graphics
101
* environment. This can be used to open a window on a different screen for
104
* @param gc the graphics environment to use
102
106
public JWindow(GraphicsConfiguration gc)
104
super(SwingUtilities.getOwnerFrame(), gc);
108
super(SwingUtilities.getOwnerFrame(null), gc);
113
* Creates a new <code>JWindow</code> that has the specified
114
* <code>owner</code> frame. If <code>owner</code> is <code>null</code>, then
115
* an invisible shared owner frame is installed as owner frame.
117
* @param owner the owner frame of this window; if <code>null</code> a shared
118
* invisible owner frame is used
108
120
public JWindow(Frame owner)
122
super(SwingUtilities.getOwnerFrame(owner));
127
* Creates a new <code>JWindow</code> that has the specified
128
* <code>owner</code> window. If <code>owner</code> is <code>null</code>,
129
* then an invisible shared owner frame is installed as owner frame.
131
* @param owner the owner window of this window; if <code>null</code> a
132
* shared invisible owner frame is used
114
134
public JWindow(Window owner)
136
super(SwingUtilities.getOwnerFrame(owner));
141
* Creates a new <code>JWindow</code> for the given graphics configuration
142
* and that has the specified <code>owner</code> window. If
143
* <code>owner</code> is <code>null</code>, then an invisible shared owner
144
* frame is installed as owner frame.
146
* The <code>gc</code> parameter can be used to open the window on a
147
* different screen for example.
149
* @param owner the owner window of this window; if <code>null</code> a
150
* shared invisible owner frame is used
151
* @param gc the graphics configuration to use
120
153
public JWindow(Window owner, GraphicsConfiguration gc)
155
super(SwingUtilities.getOwnerFrame(owner), gc);
128
161
super.setLayout(new BorderLayout(1, 1));
129
162
getRootPane(); // will do set/create
130
163
// Now we're done init stage, adds and layouts go to content pane.
131
initStageDone = true;
164
setRootPaneCheckingEnabled(true);
134
167
public Dimension getPreferredSize()
141
174
// Check if we're in initialization stage. If so, call super.setLayout
142
175
// otherwise, valid calls go to the content pane.
145
if (isRootPaneCheckingEnabled())
146
throw new Error("Cannot set layout. Use getContentPane().setLayout()"
148
getContentPane().setLayout(manager);
176
if (isRootPaneCheckingEnabled())
177
getContentPane().setLayout(manager);
151
179
super.setLayout(manager);
208
236
// If we're adding in the initialization stage use super.add.
209
237
// otherwise pass the add onto the content pane.
238
if (isRootPaneCheckingEnabled())
239
getContentPane().add(comp, constraints, index);
211
241
super.addImpl(comp, constraints, index);
214
if (isRootPaneCheckingEnabled())
215
throw new Error("Do not use add() on JWindow directly. Use "
216
+ "getContentPane().add() instead");
217
getContentPane().add(comp, constraints, index);
221
244
public void remove(Component comp)