]>
Commit | Line | Data |
---|---|---|
7bde45b2 | 1 | /* Window.java -- |
5aac1dac | 2 | Copyright (C) 1999, 2000, 2002, 2003 Free Software Foundation |
fd164b17 | 3 | |
3bd483f2 TT |
4 | This file is part of GNU Classpath. |
5 | ||
6 | GNU Classpath is free software; you can redistribute it and/or modify | |
7 | it under the terms of the GNU General Public License as published by | |
8 | the Free Software Foundation; either version 2, or (at your option) | |
9 | any later version. | |
10 | ||
11 | GNU Classpath is distributed in the hope that it will be useful, but | |
12 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 | General Public License for more details. | |
15 | ||
16 | You should have received a copy of the GNU General Public License | |
17 | along with GNU Classpath; see the file COPYING. If not, write to the | |
18 | Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA | |
19 | 02111-1307 USA. | |
20 | ||
92aaa246 MW |
21 | Linking this library statically or dynamically with other modules is |
22 | making a combined work based on this library. Thus, the terms and | |
23 | conditions of the GNU General Public License cover the whole | |
24 | combination. | |
25 | ||
26 | As a special exception, the copyright holders of this library give you | |
27 | permission to link this library with independent modules to produce an | |
28 | executable, regardless of the license terms of these independent | |
29 | modules, and to copy and distribute the resulting executable under | |
30 | terms of your choice, provided that you also meet, for each linked | |
31 | independent module, the terms and conditions of the license of that | |
32 | module. An independent module is a module which is not derived from | |
33 | or based on this library. If you modify this library, you may extend | |
34 | this exception to your version of the library, but you are not | |
35 | obligated to do so. If you do not wish to do so, delete this | |
36 | exception statement from your version. */ | |
fd164b17 | 37 | |
7bde45b2 | 38 | |
fd164b17 | 39 | package java.awt; |
7bde45b2 | 40 | |
e0a339f7 | 41 | import java.awt.event.WindowEvent; |
30df932c | 42 | import java.awt.event.WindowFocusListener; |
fd164b17 | 43 | import java.awt.event.WindowListener; |
30df932c | 44 | import java.awt.event.WindowStateListener; |
e0a339f7 TT |
45 | import java.awt.peer.WindowPeer; |
46 | import java.awt.peer.ComponentPeer; | |
b9960613 | 47 | import java.util.EventListener; |
e0a339f7 | 48 | import java.util.Locale; |
b9960613 | 49 | import java.util.ResourceBundle; |
fd164b17 | 50 | |
3bd483f2 TT |
51 | /** |
52 | * This class represents a top-level window with no decorations. | |
53 | * | |
54 | * @author Aaron M. Renn (arenn@urbanophile.com) | |
55 | * @author Warren Levy <warrenl@cygnus.com> | |
56 | */ | |
fd164b17 PB |
57 | public class Window extends Container |
58 | { | |
b9960613 BM |
59 | // Serialized fields, from Sun's serialization spec. |
60 | // private FocusManager focusMgr; // FIXME: what is this? | |
61 | private String warningString = null; | |
62 | private int state = 0; | |
63 | private int windowSerializedDataVersion = 0; // FIXME | |
64 | ||
65 | private transient WindowListener windowListener; | |
30df932c MK |
66 | private transient WindowFocusListener windowFocusListener; |
67 | private transient WindowStateListener windowStateListener; | |
b9960613 BM |
68 | private transient GraphicsConfiguration graphicsConfiguration; |
69 | ||
777e6d79 RR |
70 | /** |
71 | * This (package access) constructor is used by subclasses that want | |
72 | * to build windows that do not have parents. Eg. toplevel | |
73 | * application frames. Subclasses cannot call super(null), since | |
74 | * null is an illegal argument. | |
75 | */ | |
76 | Window() | |
77 | { | |
78 | setVisible(false); | |
79 | setLayout((LayoutManager) new BorderLayout()); | |
80 | } | |
81 | ||
82 | Window(GraphicsConfiguration gc) | |
83 | { | |
84 | this(); | |
85 | graphicsConfiguration = gc; | |
86 | } | |
87 | ||
3bd483f2 TT |
88 | /** |
89 | * Initializes a new instance of <code>Window</code> with the specified | |
90 | * parent. The window will initially be invisible. | |
91 | * | |
92 | * @param parent The owning <code>Frame</code> of this window. | |
7365ecf7 MK |
93 | * |
94 | * @exception IllegalArgumentException If the owner's GraphicsConfiguration | |
95 | * is not from a screen device, or if owner is null; this exception is always | |
96 | * thrown when GraphicsEnvironment.isHeadless returns true. | |
3bd483f2 | 97 | */ |
b9960613 BM |
98 | public Window(Frame owner) |
99 | { | |
7365ecf7 | 100 | this (owner, owner.getGraphicsConfiguration ()); |
b9960613 BM |
101 | } |
102 | ||
7365ecf7 MK |
103 | /** |
104 | * Initializes a new instance of <code>Window</code> with the specified | |
105 | * parent. The window will initially be invisible. | |
106 | * | |
107 | * @exception IllegalArgumentException If the owner's GraphicsConfiguration | |
108 | * is not from a screen device, or if owner is null; this exception is always | |
109 | * thrown when GraphicsEnvironment.isHeadless returns true. | |
110 | * | |
111 | * @since 1.2 | |
112 | */ | |
b9960613 | 113 | public Window(Window owner) |
e0a339f7 | 114 | { |
7365ecf7 | 115 | this (owner, owner.getGraphicsConfiguration ()); |
b9960613 BM |
116 | } |
117 | ||
7365ecf7 MK |
118 | /** |
119 | * Initializes a new instance of <code>Window</code> with the specified | |
120 | * parent. The window will initially be invisible. | |
121 | * | |
122 | * @exception IllegalArgumentException If owner is null or if gc is not from a | |
123 | * screen device; this exception is always thrown when | |
124 | * GraphicsEnvironment.isHeadless returns true. | |
125 | * | |
126 | * @since 1.3 | |
127 | */ | |
b9960613 BM |
128 | public Window(Window owner, GraphicsConfiguration gc) |
129 | { | |
7365ecf7 | 130 | this (); |
777e6d79 | 131 | |
7365ecf7 MK |
132 | if (owner == null) |
133 | throw new IllegalArgumentException ("owner must not be null"); | |
134 | ||
135 | this.parent = owner; | |
136 | ||
137 | // FIXME: add to owner's "owned window" list | |
138 | //owner.owned.add(this); // this should be a weak reference | |
139 | ||
b9960613 BM |
140 | /* FIXME: Security check |
141 | SecurityManager.checkTopLevelWindow(...) | |
7365ecf7 | 142 | */ |
b9960613 BM |
143 | |
144 | if (gc != null | |
145 | && gc.getDevice().getType() != GraphicsDevice.TYPE_RASTER_SCREEN) | |
146 | throw new IllegalArgumentException ("gc must be from a screen device"); | |
147 | ||
5aac1dac TT |
148 | // FIXME: until we implement this, it just causes AWT to crash. |
149 | // if (gc == null) | |
150 | // graphicsConfiguration = GraphicsEnvironment.getLocalGraphicsEnvironment() | |
151 | // .getDefaultScreenDevice() | |
152 | // .getDefaultConfiguration(); | |
153 | // else | |
7365ecf7 | 154 | graphicsConfiguration = gc; |
777e6d79 | 155 | } |
b9960613 | 156 | |
777e6d79 RR |
157 | GraphicsConfiguration getGraphicsConfigurationImpl() |
158 | { | |
159 | if (graphicsConfiguration != null) | |
160 | return graphicsConfiguration; | |
161 | ||
162 | return super.getGraphicsConfigurationImpl(); | |
e0a339f7 TT |
163 | } |
164 | ||
7365ecf7 MK |
165 | /** |
166 | * Disposes of the input methods and context, and removes the WeakReference | |
167 | * which formerly pointed to this Window from the parent's owned Window list. | |
168 | * | |
169 | * @exception Throwable The Exception raised by this method. | |
170 | */ | |
b9960613 BM |
171 | protected void finalize() throws Throwable |
172 | { | |
173 | // FIXME: remove from owner's "owned window" list (Weak References) | |
777e6d79 | 174 | super.finalize(); |
b9960613 BM |
175 | } |
176 | ||
3bd483f2 TT |
177 | /** |
178 | * Creates the native peer for this window. | |
179 | */ | |
b9960613 | 180 | public void addNotify() |
e0a339f7 TT |
181 | { |
182 | if (peer == null) | |
7bde45b2 BM |
183 | peer = getToolkit().createWindow(this); |
184 | super.addNotify(); | |
e0a339f7 | 185 | } |
fd164b17 | 186 | |
3bd483f2 TT |
187 | /** |
188 | * Relays out this window's child components at their preferred size. | |
189 | * | |
190 | * @specnote pack() doesn't appear to be called internally by show(), so | |
191 | * we duplicate some of the functionality. | |
192 | */ | |
b9960613 | 193 | public void pack() |
e0a339f7 | 194 | { |
ad980a7b | 195 | if (parent != null && !parent.isDisplayable()) |
b9960613 | 196 | parent.addNotify(); |
777e6d79 | 197 | if (peer == null) |
b9960613 | 198 | addNotify(); |
777e6d79 RR |
199 | |
200 | setSize(getPreferredSize()); | |
ad980a7b | 201 | |
b9960613 BM |
202 | validate(); |
203 | } | |
204 | ||
3bd483f2 TT |
205 | /** |
206 | * Makes this window visible and brings it to the front. | |
207 | */ | |
7bde45b2 | 208 | public void show() |
b9960613 | 209 | { |
ad980a7b TT |
210 | if (parent != null && !parent.isDisplayable()) |
211 | parent.addNotify(); | |
777e6d79 RR |
212 | if (peer == null) |
213 | addNotify(); | |
b9960613 | 214 | |
ad980a7b | 215 | validate(); |
7e89296c | 216 | super.show(); |
3bd483f2 | 217 | toFront(); |
b9960613 BM |
218 | } |
219 | ||
220 | public void hide() | |
221 | { | |
7365ecf7 | 222 | // FIXME: call hide() on any "owned" children here. |
7e89296c | 223 | super.hide(); |
b9960613 BM |
224 | } |
225 | ||
ad980a7b TT |
226 | public boolean isDisplayable() |
227 | { | |
228 | if (super.isDisplayable()) | |
229 | return true; | |
230 | return peer != null; | |
231 | } | |
232 | ||
3bd483f2 TT |
233 | /** |
234 | * Called to free any resource associated with this window. | |
235 | */ | |
b9960613 BM |
236 | public void dispose() |
237 | { | |
777e6d79 RR |
238 | hide(); |
239 | ||
240 | Window[] list = getOwnedWindows(); | |
241 | for (int i=0; i<list.length; i++) | |
242 | list[i].dispose(); | |
243 | ||
b9960613 BM |
244 | for (int i = 0; i < ncomponents; ++i) |
245 | component[i].removeNotify(); | |
246 | this.removeNotify(); | |
e0a339f7 TT |
247 | } |
248 | ||
3bd483f2 TT |
249 | /** |
250 | * Sends this window to the back so that all other windows display in | |
251 | * front of it. | |
252 | */ | |
7bde45b2 | 253 | public void toBack() |
e0a339f7 | 254 | { |
b9960613 BM |
255 | if (peer != null) |
256 | { | |
257 | WindowPeer wp = (WindowPeer) peer; | |
7bde45b2 | 258 | wp.toBack(); |
b9960613 | 259 | } |
e0a339f7 TT |
260 | } |
261 | ||
3bd483f2 TT |
262 | /** |
263 | * Brings this window to the front so that it displays in front of | |
264 | * any other windows. | |
265 | */ | |
7bde45b2 | 266 | public void toFront() |
e0a339f7 | 267 | { |
b9960613 BM |
268 | if (peer != null) |
269 | { | |
7365ecf7 MK |
270 | WindowPeer wp = (WindowPeer) peer; |
271 | wp.toFront(); | |
b9960613 BM |
272 | } |
273 | } | |
274 | ||
3bd483f2 TT |
275 | /** |
276 | * Returns the toolkit used to create this window. | |
277 | * | |
278 | * @return The toolkit used to create this window. | |
279 | * | |
280 | * @specnote Unlike Component.getToolkit, this implementation always | |
281 | * returns the value of Toolkit.getDefaultToolkit(). | |
282 | */ | |
b9960613 BM |
283 | public Toolkit getToolkit() |
284 | { | |
7bde45b2 | 285 | return Toolkit.getDefaultToolkit(); |
b9960613 BM |
286 | } |
287 | ||
3bd483f2 TT |
288 | /** |
289 | * Returns the warning string that will be displayed if this window is | |
290 | * popped up by an unsecure applet or application. | |
291 | * | |
292 | * @return The unsecure window warning message. | |
293 | */ | |
b9960613 BM |
294 | public final String getWarningString() |
295 | { | |
296 | boolean secure = true; | |
297 | /* boolean secure = SecurityManager.checkTopLevelWindow(...) */ | |
298 | ||
299 | if (!secure) | |
300 | { | |
301 | if (warningString != null) | |
7365ecf7 MK |
302 | return warningString; |
303 | else | |
304 | { | |
305 | String warning = System.getProperty("awt.appletWarning"); | |
306 | return warning; | |
307 | } | |
b9960613 BM |
308 | } |
309 | return null; | |
e0a339f7 | 310 | } |
fd164b17 | 311 | |
3bd483f2 TT |
312 | /** |
313 | * Returns the locale that this window is configured for. | |
314 | * | |
315 | * @return The locale this window is configured for. | |
316 | */ | |
7bde45b2 | 317 | public Locale getLocale() |
e0a339f7 | 318 | { |
7bde45b2 | 319 | return locale == null ? Locale.getDefault() : locale; |
e0a339f7 TT |
320 | } |
321 | ||
b9960613 BM |
322 | /* |
323 | /** @since 1.2 | |
324 | public InputContext getInputContext() | |
e0a339f7 | 325 | { |
b9960613 | 326 | // FIXME |
e0a339f7 | 327 | } |
b9960613 | 328 | */ |
e0a339f7 | 329 | |
3bd483f2 TT |
330 | /** |
331 | * Sets the cursor for this window to the specifiec cursor. | |
332 | * | |
333 | * @param cursor The new cursor for this window. | |
334 | */ | |
b9960613 | 335 | public void setCursor(Cursor cursor) |
e0a339f7 | 336 | { |
b9960613 BM |
337 | super.setCursor(cursor); |
338 | } | |
339 | ||
340 | public Window getOwner() | |
341 | { | |
777e6d79 | 342 | return (Window) parent; |
e0a339f7 TT |
343 | } |
344 | ||
b9960613 BM |
345 | /** @since 1.2 */ |
346 | public Window[] getOwnedWindows() | |
e0a339f7 | 347 | { |
b9960613 BM |
348 | // FIXME: return array containing all the windows this window currently |
349 | // owns. | |
6c54b16c | 350 | return new Window[0]; |
b9960613 BM |
351 | } |
352 | ||
3bd483f2 TT |
353 | /** |
354 | * Adds the specified listener to the list of <code>WindowListeners</code> | |
355 | * that will receive events for this window. | |
356 | * | |
357 | * @param listener The <code>WindowListener</code> to add. | |
358 | */ | |
7bde45b2 | 359 | public synchronized void addWindowListener(WindowListener listener) |
b9960613 | 360 | { |
7bde45b2 | 361 | windowListener = AWTEventMulticaster.add(windowListener, listener); |
b9960613 BM |
362 | } |
363 | ||
3bd483f2 TT |
364 | /** |
365 | * Removes the specified listener from the list of | |
366 | * <code>WindowListeners</code> that will receive events for this window. | |
367 | * | |
368 | * @param listener The <code>WindowListener</code> to remove. | |
369 | */ | |
7bde45b2 BM |
370 | public synchronized void removeWindowListener(WindowListener listener) |
371 | { | |
372 | windowListener = AWTEventMulticaster.remove(windowListener, listener); | |
373 | } | |
374 | ||
7365ecf7 MK |
375 | /** |
376 | * Returns an array of all the window listeners registered on this window. | |
377 | * | |
378 | * @since 1.4 | |
379 | */ | |
7bde45b2 | 380 | public synchronized WindowListener[] getWindowListeners() |
b9960613 | 381 | { |
7bde45b2 BM |
382 | return (WindowListener[]) |
383 | AWTEventMulticaster.getListeners(windowListener, | |
384 | WindowListener.class); | |
b9960613 BM |
385 | } |
386 | ||
30df932c MK |
387 | /** |
388 | * Returns an array of all the window focus listeners registered on this | |
389 | * window. | |
390 | * | |
391 | * @since 1.4 | |
392 | */ | |
393 | public synchronized WindowFocusListener[] getWindowFocusListeners() | |
394 | { | |
395 | return (WindowFocusListener[]) | |
396 | AWTEventMulticaster.getListeners(windowFocusListener, | |
397 | WindowFocusListener.class); | |
398 | } | |
399 | ||
400 | /** | |
401 | * Returns an array of all the window state listeners registered on this | |
402 | * window. | |
403 | * | |
404 | * @since 1.4 | |
405 | */ | |
406 | public synchronized WindowStateListener[] getWindowStateListeners() | |
407 | { | |
408 | return (WindowStateListener[]) | |
409 | AWTEventMulticaster.getListeners(windowStateListener, | |
410 | WindowStateListener.class); | |
411 | } | |
412 | ||
413 | /** | |
414 | * Adds the specified listener to this window. | |
415 | */ | |
416 | public void addWindowFocusListener (WindowFocusListener wfl) | |
417 | { | |
418 | AWTEventMulticaster.add (windowFocusListener, wfl); | |
419 | } | |
420 | ||
421 | /** | |
422 | * Adds the specified listener to this window. | |
423 | * | |
424 | * @since 1.4 | |
425 | */ | |
426 | public void addWindowStateListener (WindowStateListener wsl) | |
427 | { | |
428 | AWTEventMulticaster.add (windowStateListener, wsl); | |
429 | } | |
430 | ||
431 | /** | |
432 | * Removes the specified listener from this window. | |
433 | */ | |
434 | public void removeWindowFocusListener (WindowFocusListener wfl) | |
435 | { | |
436 | AWTEventMulticaster.remove (windowFocusListener, wfl); | |
437 | } | |
438 | ||
439 | /** | |
440 | * Removes the specified listener from this window. | |
441 | * | |
442 | * @since 1.4 | |
443 | */ | |
444 | public void removeWindowStateListener (WindowStateListener wsl) | |
445 | { | |
446 | AWTEventMulticaster.remove (windowStateListener, wsl); | |
447 | } | |
448 | ||
7365ecf7 MK |
449 | /** |
450 | * Returns an array of all the objects currently registered as FooListeners | |
451 | * upon this Window. FooListeners are registered using the addFooListener | |
452 | * method. | |
453 | * | |
454 | * @exception ClassCastException If listenerType doesn't specify a class or | |
455 | * interface that implements java.util.EventListener. | |
456 | * | |
457 | * @since 1.3 | |
458 | */ | |
b9960613 BM |
459 | public EventListener[] getListeners(Class listenerType) |
460 | { | |
461 | if (listenerType == WindowListener.class) | |
7bde45b2 BM |
462 | return getWindowListeners(); |
463 | return super.getListeners(listenerType); | |
b9960613 BM |
464 | } |
465 | ||
466 | void dispatchEventImpl(AWTEvent e) | |
467 | { | |
468 | // Make use of event id's in order to avoid multiple instanceof tests. | |
469 | if (e.id <= WindowEvent.WINDOW_LAST | |
470 | && e.id >= WindowEvent.WINDOW_FIRST | |
471 | && (windowListener != null | |
472 | || (eventMask & AWTEvent.WINDOW_EVENT_MASK) != 0)) | |
473 | processEvent(e); | |
474 | else | |
475 | super.dispatchEventImpl(e); | |
e0a339f7 TT |
476 | } |
477 | ||
3bd483f2 TT |
478 | /** |
479 | * Processes the specified event for this window. If the event is an | |
480 | * instance of <code>WindowEvent</code>, then | |
481 | * <code>processWindowEvent()</code> is called to process the event, | |
482 | * otherwise the superclass version of this method is invoked. | |
483 | * | |
484 | * @param event The event to process. | |
485 | */ | |
7bde45b2 | 486 | protected void processEvent(AWTEvent evt) |
e0a339f7 TT |
487 | { |
488 | if (evt instanceof WindowEvent) | |
7bde45b2 | 489 | processWindowEvent((WindowEvent) evt); |
e0a339f7 | 490 | else |
7bde45b2 | 491 | super.processEvent(evt); |
e0a339f7 TT |
492 | } |
493 | ||
3bd483f2 TT |
494 | /** |
495 | * Dispatches this event to any listeners that are listening for | |
496 | * <code>WindowEvents</code> on this window. This method only gets | |
497 | * invoked if it is enabled via <code>enableEvents()</code> or if | |
498 | * a listener has been added. | |
499 | * | |
500 | * @param event The event to process. | |
501 | */ | |
7bde45b2 | 502 | protected void processWindowEvent(WindowEvent evt) |
e0a339f7 TT |
503 | { |
504 | if (windowListener != null) | |
505 | { | |
76c16dd4 MK |
506 | switch (evt.getID()) |
507 | { | |
508 | case WindowEvent.WINDOW_ACTIVATED: | |
509 | windowListener.windowActivated(evt); | |
510 | break; | |
511 | case WindowEvent.WINDOW_CLOSED: | |
512 | windowListener.windowClosed(evt); | |
513 | break; | |
514 | case WindowEvent.WINDOW_CLOSING: | |
515 | windowListener.windowClosing(evt); | |
516 | break; | |
517 | case WindowEvent.WINDOW_DEACTIVATED: | |
518 | windowListener.windowDeactivated(evt); | |
519 | break; | |
520 | case WindowEvent.WINDOW_DEICONIFIED: | |
521 | windowListener.windowDeiconified(evt); | |
522 | break; | |
523 | case WindowEvent.WINDOW_ICONIFIED: | |
524 | windowListener.windowIconified(evt); | |
525 | break; | |
526 | case WindowEvent.WINDOW_OPENED: | |
527 | windowListener.windowOpened(evt); | |
528 | break; | |
2ff04cc6 MK |
529 | case WindowEvent.WINDOW_GAINED_FOCUS: |
530 | case WindowEvent.WINDOW_LOST_FOCUS: | |
531 | processWindowFocusEvent (evt); | |
532 | break; | |
533 | case WindowEvent.WINDOW_STATE_CHANGED: | |
534 | processWindowStateEvent (evt); | |
535 | break; | |
76c16dd4 | 536 | } |
e0a339f7 TT |
537 | } |
538 | } | |
539 | ||
3bd483f2 TT |
540 | /** |
541 | * Returns the child window that has focus if this window is active. | |
542 | * This method returns <code>null</code> if this window is not active | |
543 | * or no children have focus. | |
544 | * | |
545 | * @return The component that has focus, or <code>null</code> if no | |
546 | * component has focus. | |
547 | */ | |
b9960613 | 548 | public Component getFocusOwner() |
e0a339f7 | 549 | { |
b9960613 BM |
550 | // FIXME |
551 | return null; | |
e0a339f7 | 552 | } |
fd164b17 | 553 | |
3bd483f2 TT |
554 | /** |
555 | * Post a Java 1.0 event to the event queue. | |
556 | * | |
557 | * @param event The event to post. | |
2ff04cc6 MK |
558 | * |
559 | * @deprecated | |
3bd483f2 | 560 | */ |
b9960613 | 561 | public boolean postEvent(Event e) |
fd164b17 | 562 | { |
b9960613 BM |
563 | // FIXME |
564 | return false; | |
e0a339f7 TT |
565 | } |
566 | ||
3bd483f2 TT |
567 | /** |
568 | * Tests whether or not this window is visible on the screen. | |
569 | * | |
570 | * @return <code>true</code> if this window is visible, <code>false</code> | |
571 | * otherwise. | |
572 | */ | |
b9960613 | 573 | public boolean isShowing() |
e0a339f7 | 574 | { |
3bd483f2 | 575 | return super.isShowing(); |
fd164b17 | 576 | } |
e0a339f7 | 577 | |
2ff04cc6 MK |
578 | /** |
579 | * @since 1.2 | |
580 | * | |
581 | * @deprecated | |
582 | */ | |
b9960613 | 583 | public void applyResourceBundle(ResourceBundle rb) |
e0a339f7 | 584 | { |
b9960613 | 585 | // FIXME |
e0a339f7 TT |
586 | } |
587 | ||
2ff04cc6 MK |
588 | /** |
589 | * @since 1.2 | |
590 | * | |
591 | * @deprecated | |
592 | */ | |
b9960613 BM |
593 | public void applyResourceBundle(String rbName) |
594 | { | |
595 | ResourceBundle rb = ResourceBundle.getBundle(rbName); | |
596 | if (rb != null) | |
597 | applyResourceBundle(rb); | |
598 | } | |
e0a339f7 | 599 | |
b9960613 BM |
600 | /* |
601 | public AccessibleContext getAccessibleContext() | |
602 | { | |
603 | // FIXME | |
604 | } | |
605 | */ | |
606 | ||
777e6d79 RR |
607 | /** |
608 | * Get graphics configuration. The implementation for Window will | |
609 | * not ask any parent containers, since Window is a toplevel | |
610 | * window and not actually embedded in the parent component. | |
611 | */ | |
b9960613 BM |
612 | public GraphicsConfiguration getGraphicsConfiguration() |
613 | { | |
777e6d79 RR |
614 | if (graphicsConfiguration != null) return graphicsConfiguration; |
615 | if (peer != null) return peer.getGraphicsConfiguration(); | |
616 | return null; | |
b9960613 | 617 | } |
2ff04cc6 MK |
618 | |
619 | protected void processWindowFocusEvent(WindowEvent event) | |
620 | { | |
621 | if (windowFocusListener != null) | |
622 | { | |
623 | switch (event.getID ()) | |
624 | { | |
625 | case WindowEvent.WINDOW_GAINED_FOCUS: | |
626 | windowFocusListener.windowGainedFocus (event); | |
627 | break; | |
628 | ||
629 | case WindowEvent.WINDOW_LOST_FOCUS: | |
630 | windowFocusListener.windowLostFocus (event); | |
631 | break; | |
632 | ||
633 | default: | |
634 | break; | |
635 | } | |
636 | } | |
637 | } | |
638 | ||
639 | /** | |
640 | * @since 1.4 | |
641 | */ | |
642 | protected void processWindowStateEvent(WindowEvent event) | |
643 | { | |
644 | if (windowStateListener != null | |
645 | && event.getID () == WindowEvent.WINDOW_STATE_CHANGED) | |
646 | windowStateListener.windowStateChanged (event); | |
647 | } | |
fd164b17 | 648 | } |