86 |
* parent. The window will initially be invisible. |
* parent. The window will initially be invisible. |
87 |
* |
* |
88 |
* @param parent The owning <code>Frame</code> of this window. |
* @param parent The owning <code>Frame</code> of this window. |
89 |
|
* |
90 |
|
* @exception IllegalArgumentException If the owner's GraphicsConfiguration |
91 |
|
* is not from a screen device, or if owner is null; this exception is always |
92 |
|
* thrown when GraphicsEnvironment.isHeadless returns true. |
93 |
*/ |
*/ |
94 |
public Window(Frame owner) |
public Window(Frame owner) |
95 |
{ |
{ |
96 |
this((Window) owner); |
this (owner, owner.getGraphicsConfiguration ()); |
97 |
} |
} |
98 |
|
|
99 |
/** @since 1.2 */ |
/** |
100 |
|
* Initializes a new instance of <code>Window</code> with the specified |
101 |
|
* parent. The window will initially be invisible. |
102 |
|
* |
103 |
|
* @exception IllegalArgumentException If the owner's GraphicsConfiguration |
104 |
|
* is not from a screen device, or if owner is null; this exception is always |
105 |
|
* thrown when GraphicsEnvironment.isHeadless returns true. |
106 |
|
* |
107 |
|
* @since 1.2 |
108 |
|
*/ |
109 |
public Window(Window owner) |
public Window(Window owner) |
110 |
{ |
{ |
111 |
this(); |
this (owner, owner.getGraphicsConfiguration ()); |
|
if (owner == null) |
|
|
throw new IllegalArgumentException("owner must not be null"); |
|
|
|
|
|
this.parent = owner; |
|
|
|
|
|
// FIXME: add to owner's "owned window" list |
|
|
//owner.owned.add(this); // this should be a weak reference |
|
112 |
} |
} |
113 |
|
|
114 |
/** @since 1.3 */ |
/** |
115 |
|
* Initializes a new instance of <code>Window</code> with the specified |
116 |
|
* parent. The window will initially be invisible. |
117 |
|
* |
118 |
|
* @exception IllegalArgumentException If owner is null or if gc is not from a |
119 |
|
* screen device; this exception is always thrown when |
120 |
|
* GraphicsEnvironment.isHeadless returns true. |
121 |
|
* |
122 |
|
* @since 1.3 |
123 |
|
*/ |
124 |
public Window(Window owner, GraphicsConfiguration gc) |
public Window(Window owner, GraphicsConfiguration gc) |
125 |
{ |
{ |
126 |
this(owner); |
this (); |
127 |
|
|
128 |
|
if (owner == null) |
129 |
|
throw new IllegalArgumentException ("owner must not be null"); |
130 |
|
|
131 |
|
this.parent = owner; |
132 |
|
|
133 |
|
// FIXME: add to owner's "owned window" list |
134 |
|
//owner.owned.add(this); // this should be a weak reference |
135 |
|
|
136 |
/* FIXME: Security check |
/* FIXME: Security check |
137 |
SecurityManager.checkTopLevelWindow(...) |
SecurityManager.checkTopLevelWindow(...) |
138 |
|
*/ |
139 |
|
|
140 |
if (gc != null |
if (gc != null |
141 |
&& gc.getDevice().getType() != GraphicsDevice.TYPE_RASTER_SCREEN) |
&& gc.getDevice().getType() != GraphicsDevice.TYPE_RASTER_SCREEN) |
143 |
|
|
144 |
if (gc == null) |
if (gc == null) |
145 |
graphicsConfiguration = GraphicsEnvironment.getLocalGraphicsEnvironment() |
graphicsConfiguration = GraphicsEnvironment.getLocalGraphicsEnvironment() |
146 |
.getDefaultScreenDevice() |
.getDefaultScreenDevice() |
147 |
.getDefaultConfiguration(); |
.getDefaultConfiguration(); |
148 |
else |
else |
149 |
*/ |
graphicsConfiguration = gc; |
|
graphicsConfiguration = gc; |
|
150 |
} |
} |
151 |
|
|
152 |
GraphicsConfiguration getGraphicsConfigurationImpl() |
GraphicsConfiguration getGraphicsConfigurationImpl() |
157 |
return super.getGraphicsConfigurationImpl(); |
return super.getGraphicsConfigurationImpl(); |
158 |
} |
} |
159 |
|
|
160 |
|
/** |
161 |
|
* Disposes of the input methods and context, and removes the WeakReference |
162 |
|
* which formerly pointed to this Window from the parent's owned Window list. |
163 |
|
* |
164 |
|
* @exception Throwable The Exception raised by this method. |
165 |
|
*/ |
166 |
protected void finalize() throws Throwable |
protected void finalize() throws Throwable |
167 |
{ |
{ |
168 |
// FIXME: remove from owner's "owned window" list (Weak References) |
// FIXME: remove from owner's "owned window" list (Weak References) |
214 |
|
|
215 |
public void hide() |
public void hide() |
216 |
{ |
{ |
217 |
// FIXME: call hide() on amy "owned" children here. |
// FIXME: call hide() on any "owned" children here. |
218 |
super.hide(); |
super.hide(); |
219 |
} |
} |
220 |
|
|
262 |
{ |
{ |
263 |
if (peer != null) |
if (peer != null) |
264 |
{ |
{ |
265 |
WindowPeer wp = (WindowPeer) peer; |
WindowPeer wp = (WindowPeer) peer; |
266 |
wp.toFront(); |
wp.toFront(); |
267 |
} |
} |
268 |
} |
} |
269 |
|
|
294 |
if (!secure) |
if (!secure) |
295 |
{ |
{ |
296 |
if (warningString != null) |
if (warningString != null) |
297 |
return warningString; |
return warningString; |
298 |
else |
else |
299 |
{ |
{ |
300 |
String warning = System.getProperty("awt.appletWarning"); |
String warning = System.getProperty("awt.appletWarning"); |
301 |
return warning; |
return warning; |
302 |
} |
} |
303 |
} |
} |
304 |
return null; |
return null; |
305 |
} |
} |
367 |
windowListener = AWTEventMulticaster.remove(windowListener, listener); |
windowListener = AWTEventMulticaster.remove(windowListener, listener); |
368 |
} |
} |
369 |
|
|
370 |
|
/** |
371 |
|
* Returns an array of all the window listeners registered on this window. |
372 |
|
* |
373 |
|
* @since 1.4 |
374 |
|
*/ |
375 |
public synchronized WindowListener[] getWindowListeners() |
public synchronized WindowListener[] getWindowListeners() |
376 |
{ |
{ |
377 |
return (WindowListener[]) |
return (WindowListener[]) |
379 |
WindowListener.class); |
WindowListener.class); |
380 |
} |
} |
381 |
|
|
382 |
/** @since 1.3 */ |
/** |
383 |
|
* Returns an array of all the objects currently registered as FooListeners |
384 |
|
* upon this Window. FooListeners are registered using the addFooListener |
385 |
|
* method. |
386 |
|
* |
387 |
|
* @exception ClassCastException If listenerType doesn't specify a class or |
388 |
|
* interface that implements java.util.EventListener. |
389 |
|
* |
390 |
|
* @since 1.3 |
391 |
|
*/ |
392 |
public EventListener[] getListeners(Class listenerType) |
public EventListener[] getListeners(Class listenerType) |
393 |
{ |
{ |
394 |
if (listenerType == WindowListener.class) |
if (listenerType == WindowListener.class) |