2 Copyright (C) 1999, 2000, 2002, 2003, 2004 Free Software Foundation
4 This file is part of GNU Classpath.
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)
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.
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
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
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. */
41 import java.awt.event.ComponentEvent;
42 import java.awt.event.FocusEvent;
43 import java.awt.event.WindowAdapter;
44 import java.awt.event.WindowEvent;
45 import java.awt.event.WindowFocusListener;
46 import java.awt.event.WindowListener;
47 import java.awt.event.WindowStateListener;
48 import java.awt.image.BufferStrategy;
49 import java.awt.peer.WindowPeer;
50 import java.lang.ref.Reference;
51 import java.lang.ref.WeakReference;
52 import java.util.EventListener;
53 import java.util.Iterator;
54 import java.util.Locale;
55 import java.util.ResourceBundle;
56 import java.util.Vector;
58 import javax.accessibility.Accessible;
59 import javax.accessibility.AccessibleContext;
60 import javax.accessibility.AccessibleRole;
61 import javax.accessibility.AccessibleState;
62 import javax.accessibility.AccessibleStateSet;
65 * This class represents a top-level window with no decorations.
67 * @author Aaron M. Renn (arenn@urbanophile.com)
68 * @author Warren Levy (warrenl@cygnus.com)
70 public class Window extends Container implements Accessible
72 private static final long serialVersionUID = 4497834738069338734L;
74 // Serialized fields, from Sun's serialization spec.
75 private String warningString = null;
76 private int windowSerializedDataVersion = 0; // FIXME
78 // private FocusManager focusMgr; // FIXME: what is this?
80 private int state = 0;
82 private boolean focusableWindowState = true;
84 // A list of other top-level windows owned by this window.
85 private transient Vector ownedWindows = new Vector();
87 private transient WindowListener windowListener;
88 private transient WindowFocusListener windowFocusListener;
89 private transient WindowStateListener windowStateListener;
90 private transient GraphicsConfiguration graphicsConfiguration;
92 private transient boolean shown;
94 // This is package-private to avoid an accessor method.
95 transient Component windowFocusOwner;
98 * The number used to generate the name returned by getName.
100 private static transient long next_window_number;
102 protected class AccessibleAWTWindow extends AccessibleAWTContainer
104 public AccessibleRole getAccessibleRole()
106 return AccessibleRole.WINDOW;
109 public AccessibleStateSet getAccessibleStateSet()
111 AccessibleStateSet states = super.getAccessibleStateSet();
113 states.add(AccessibleState.ACTIVE);
119 * This (package access) constructor is used by subclasses that want
120 * to build windows that do not have parents. Eg. toplevel
121 * application frames. Subclasses cannot call super(null), since
122 * null is an illegal argument.
127 // Windows are the only Containers that default to being focus
129 focusCycleRoot = true;
130 setLayout(new BorderLayout());
132 addWindowFocusListener (new WindowAdapter ()
134 public void windowGainedFocus (WindowEvent event)
136 if (windowFocusOwner != null)
138 // FIXME: move this section and the other similar
139 // sections in Component into a separate method.
140 EventQueue eq = Toolkit.getDefaultToolkit ().getSystemEventQueue ();
143 KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager ();
144 Component currentFocusOwner = manager.getGlobalPermanentFocusOwner ();
145 if (currentFocusOwner != null)
147 eq.postEvent (new FocusEvent (currentFocusOwner, FocusEvent.FOCUS_LOST,
148 false, windowFocusOwner));
149 eq.postEvent (new FocusEvent (windowFocusOwner, FocusEvent.FOCUS_GAINED,
150 false, currentFocusOwner));
153 eq.postEvent (new FocusEvent (windowFocusOwner, FocusEvent.FOCUS_GAINED, false));
160 Window(GraphicsConfiguration gc)
163 graphicsConfiguration = gc;
167 * Initializes a new instance of <code>Window</code> with the specified
168 * parent. The window will initially be invisible.
170 * @param owner The owning <code>Frame</code> of this window.
172 * @exception IllegalArgumentException If the owner's GraphicsConfiguration
173 * is not from a screen device, or if owner is null; this exception is always
174 * thrown when GraphicsEnvironment.isHeadless returns true.
176 public Window(Frame owner)
178 this (owner, owner.getGraphicsConfiguration ());
182 * Initializes a new instance of <code>Window</code> with the specified
183 * parent. The window will initially be invisible.
185 * @exception IllegalArgumentException If the owner's GraphicsConfiguration
186 * is not from a screen device, or if owner is null; this exception is always
187 * thrown when GraphicsEnvironment.isHeadless returns true.
191 public Window(Window owner)
193 this (owner, owner.getGraphicsConfiguration ());
197 * Initializes a new instance of <code>Window</code> with the specified
198 * parent. The window will initially be invisible.
200 * @exception IllegalArgumentException If owner is null or if gc is not from a
201 * screen device; this exception is always thrown when
202 * GraphicsEnvironment.isHeadless returns true.
206 public Window(Window owner, GraphicsConfiguration gc)
210 synchronized (getTreeLock())
213 throw new IllegalArgumentException ("owner must not be null");
216 owner.ownedWindows.add(new WeakReference(this));
219 // FIXME: make this text visible in the window.
220 SecurityManager s = System.getSecurityManager();
221 if (s != null && ! s.checkTopLevelWindow(this))
222 warningString = System.getProperty("awt.appletWarning");
225 && gc.getDevice().getType() != GraphicsDevice.TYPE_RASTER_SCREEN)
226 throw new IllegalArgumentException ("gc must be from a screen device");
229 graphicsConfiguration = GraphicsEnvironment.getLocalGraphicsEnvironment()
230 .getDefaultScreenDevice()
231 .getDefaultConfiguration();
233 graphicsConfiguration = gc;
236 GraphicsConfiguration getGraphicsConfigurationImpl()
238 if (graphicsConfiguration != null)
239 return graphicsConfiguration;
241 return super.getGraphicsConfigurationImpl();
245 * Creates the native peer for this window.
247 public void addNotify()
250 peer = getToolkit().createWindow(this);
255 * Relays out this window's child components at their preferred size.
257 * @specnote pack() doesn't appear to be called internally by show(), so
258 * we duplicate some of the functionality.
262 if (parent != null && !parent.isDisplayable())
267 setSize(getPreferredSize());
273 * Shows on-screen this window and any of its owned windows for whom
274 * isVisible returns true.
278 if (parent != null && !parent.isDisplayable())
283 // Show visible owned windows.
284 synchronized (getTreeLock())
286 Iterator e = ownedWindows.iterator();
289 Window w = (Window)(((Reference) e.next()).get());
293 w.getPeer().setVisible(true);
296 // Remove null weak reference from ownedWindows.
297 // Unfortunately this can't be done in the Window's
298 // finalize method because there is no way to guarantee
299 // synchronous access to ownedWindows there.
307 KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager ();
308 manager.setGlobalFocusedWindow (this);
312 FocusTraversalPolicy policy = getFocusTraversalPolicy ();
313 Component initialFocusOwner = null;
316 initialFocusOwner = policy.getInitialComponent (this);
318 if (initialFocusOwner != null)
319 initialFocusOwner.requestFocusInWindow ();
327 // Hide visible owned windows.
328 synchronized (getTreeLock ())
330 Iterator e = ownedWindows.iterator();
333 Window w = (Window)(((Reference) e.next()).get());
336 if (w.isVisible() && w.getPeer() != null)
337 w.getPeer().setVisible(false);
346 public boolean isDisplayable()
348 if (super.isDisplayable())
354 * Destroys any resources associated with this window. This includes
355 * all components in the window and all owned top-level windows.
357 public void dispose()
361 synchronized (getTreeLock ())
363 Iterator e = ownedWindows.iterator();
366 Window w = (Window)(((Reference) e.next()).get());
370 // Remove null weak reference from ownedWindows.
374 for (int i = 0; i < ncomponents; ++i)
375 component[i].removeNotify();
378 // Post a WINDOW_CLOSED event.
379 WindowEvent we = new WindowEvent(this, WindowEvent.WINDOW_CLOSED);
380 getToolkit().getSystemEventQueue().postEvent(we);
385 * Sends this window to the back so that all other windows display in
392 WindowPeer wp = (WindowPeer) peer;
398 * Brings this window to the front so that it displays in front of
401 public void toFront()
405 WindowPeer wp = (WindowPeer) peer;
411 * Returns the toolkit used to create this window.
413 * @return The toolkit used to create this window.
415 * @specnote Unlike Component.getToolkit, this implementation always
416 * returns the value of Toolkit.getDefaultToolkit().
418 public Toolkit getToolkit()
420 return Toolkit.getDefaultToolkit();
424 * Returns the warning string that will be displayed if this window is
425 * popped up by an unsecure applet or application.
427 * @return The unsecure window warning message.
429 public final String getWarningString()
431 return warningString;
435 * Returns the locale that this window is configured for.
437 * @return The locale this window is configured for.
439 public Locale getLocale()
441 return locale == null ? Locale.getDefault() : locale;
446 public InputContext getInputContext()
453 * Sets the cursor for this window to the specifiec cursor.
455 * @param cursor The new cursor for this window.
457 public void setCursor(Cursor cursor)
459 super.setCursor(cursor);
462 public Window getOwner()
464 return (Window) parent;
468 public Window[] getOwnedWindows()
470 Window [] trimmedList;
471 synchronized (getTreeLock ())
473 // Windows with non-null weak references in ownedWindows.
474 Window [] validList = new Window [ownedWindows.size()];
476 Iterator e = ownedWindows.iterator();
480 Window w = (Window)(((Reference) e.next()).get());
482 validList[numValid++] = w;
484 // Remove null weak reference from ownedWindows.
488 if (numValid != validList.length)
490 trimmedList = new Window [numValid];
491 System.arraycopy (validList, 0, trimmedList, 0, numValid);
494 trimmedList = validList;
500 * Adds the specified listener to the list of <code>WindowListeners</code>
501 * that will receive events for this window.
503 * @param listener The <code>WindowListener</code> to add.
505 public synchronized void addWindowListener(WindowListener listener)
507 windowListener = AWTEventMulticaster.add(windowListener, listener);
511 * Removes the specified listener from the list of
512 * <code>WindowListeners</code> that will receive events for this window.
514 * @param listener The <code>WindowListener</code> to remove.
516 public synchronized void removeWindowListener(WindowListener listener)
518 windowListener = AWTEventMulticaster.remove(windowListener, listener);
522 * Returns an array of all the window listeners registered on this window.
526 public synchronized WindowListener[] getWindowListeners()
528 return (WindowListener[])
529 AWTEventMulticaster.getListeners(windowListener,
530 WindowListener.class);
534 * Returns an array of all the window focus listeners registered on this
539 public synchronized WindowFocusListener[] getWindowFocusListeners()
541 return (WindowFocusListener[])
542 AWTEventMulticaster.getListeners(windowFocusListener,
543 WindowFocusListener.class);
547 * Returns an array of all the window state listeners registered on this
552 public synchronized WindowStateListener[] getWindowStateListeners()
554 return (WindowStateListener[])
555 AWTEventMulticaster.getListeners(windowStateListener,
556 WindowStateListener.class);
560 * Adds the specified listener to this window.
562 public void addWindowFocusListener (WindowFocusListener wfl)
564 windowFocusListener = AWTEventMulticaster.add (windowFocusListener, wfl);
568 * Adds the specified listener to this window.
572 public void addWindowStateListener (WindowStateListener wsl)
574 windowStateListener = AWTEventMulticaster.add (windowStateListener, wsl);
578 * Removes the specified listener from this window.
580 public void removeWindowFocusListener (WindowFocusListener wfl)
582 windowFocusListener = AWTEventMulticaster.remove (windowFocusListener, wfl);
586 * Removes the specified listener from this window.
590 public void removeWindowStateListener (WindowStateListener wsl)
592 windowStateListener = AWTEventMulticaster.remove (windowStateListener, wsl);
596 * Returns an array of all the objects currently registered as FooListeners
597 * upon this Window. FooListeners are registered using the addFooListener
600 * @exception ClassCastException If listenerType doesn't specify a class or
601 * interface that implements java.util.EventListener.
605 public EventListener[] getListeners(Class listenerType)
607 if (listenerType == WindowListener.class)
608 return getWindowListeners();
609 return super.getListeners(listenerType);
612 void dispatchEventImpl(AWTEvent e)
614 // Make use of event id's in order to avoid multiple instanceof tests.
615 if (e.id <= WindowEvent.WINDOW_LAST
616 && e.id >= WindowEvent.WINDOW_FIRST
617 && (windowListener != null
618 || windowFocusListener != null
619 || windowStateListener != null
620 || (eventMask & AWTEvent.WINDOW_EVENT_MASK) != 0))
623 super.dispatchEventImpl(e);
627 * Processes the specified event for this window. If the event is an
628 * instance of <code>WindowEvent</code>, then
629 * <code>processWindowEvent()</code> is called to process the event,
630 * otherwise the superclass version of this method is invoked.
632 * @param evt The event to process.
634 protected void processEvent(AWTEvent evt)
636 if (evt instanceof WindowEvent)
637 processWindowEvent((WindowEvent) evt);
639 super.processEvent(evt);
643 * Dispatches this event to any listeners that are listening for
644 * <code>WindowEvents</code> on this window. This method only gets
645 * invoked if it is enabled via <code>enableEvents()</code> or if
646 * a listener has been added.
648 * @param evt The event to process.
650 protected void processWindowEvent(WindowEvent evt)
652 int id = evt.getID();
654 if (id == WindowEvent.WINDOW_GAINED_FOCUS
655 || id == WindowEvent.WINDOW_LOST_FOCUS)
656 processWindowFocusEvent (evt);
657 else if (id == WindowEvent.WINDOW_STATE_CHANGED)
658 processWindowStateEvent (evt);
661 if (windowListener != null)
665 case WindowEvent.WINDOW_ACTIVATED:
666 windowListener.windowActivated(evt);
669 case WindowEvent.WINDOW_CLOSED:
670 windowListener.windowClosed(evt);
673 case WindowEvent.WINDOW_CLOSING:
674 windowListener.windowClosing(evt);
677 case WindowEvent.WINDOW_DEACTIVATED:
678 windowListener.windowDeactivated(evt);
681 case WindowEvent.WINDOW_DEICONIFIED:
682 windowListener.windowDeiconified(evt);
685 case WindowEvent.WINDOW_ICONIFIED:
686 windowListener.windowIconified(evt);
689 case WindowEvent.WINDOW_OPENED:
690 windowListener.windowOpened(evt);
701 * Identifies if this window is active. The active window is a Frame or
702 * Dialog that has focus or owns the active window.
704 * @return true if active, else false.
707 public boolean isActive()
709 KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager ();
710 return manager.getActiveWindow() == this;
714 * Identifies if this window is focused. A window is focused if it is the
715 * focus owner or it contains the focus owner.
717 * @return true if focused, else false.
720 public boolean isFocused()
722 KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager ();
723 return manager.getFocusedWindow() == this;
727 * Returns the child window that has focus if this window is active.
728 * This method returns <code>null</code> if this window is not active
729 * or no children have focus.
731 * @return The component that has focus, or <code>null</code> if no
732 * component has focus.
734 public Component getFocusOwner ()
736 KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager ();
738 Window activeWindow = manager.getActiveWindow ();
740 // The currently-focused Component belongs to the active Window.
741 if (activeWindow == this)
742 return manager.getFocusOwner ();
744 return windowFocusOwner;
748 * Set the focus owner for this window. This method is used to
749 * remember which component was focused when this window lost
750 * top-level focus, so that when it regains top-level focus the same
751 * child component can be refocused.
753 * @param windowFocusOwner the component in this window that owns
756 void setFocusOwner (Component windowFocusOwner)
758 this.windowFocusOwner = windowFocusOwner;
762 * Post a Java 1.0 event to the event queue.
764 * @param e The event to post.
768 public boolean postEvent(Event e)
770 return handleEvent (e);
774 * Tests whether or not this window is visible on the screen.
776 * @return <code>true</code> if this window is visible, <code>false</code>
779 public boolean isShowing()
781 return super.isShowing();
784 public void setLocationRelativeTo (Component c)
786 if (c == null || !c.isShowing ())
791 GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment ();
792 Point center = ge.getCenterPoint ();
793 x = center.x - (width / 2);
794 y = center.y - (height / 2);
797 // FIXME: handle case where component is non-null.
801 * A BltBufferStrategy for windows.
803 private class WindowBltBufferStrategy extends BltBufferStrategy
806 * Creates a block transfer strategy for this window.
808 * @param numBuffers the number of buffers in this strategy
809 * @param accelerated true if the buffer should be accelerated,
812 WindowBltBufferStrategy(int numBuffers, boolean accelerated)
815 new BufferCapabilities(new ImageCapabilities(accelerated),
816 new ImageCapabilities(accelerated),
817 BufferCapabilities.FlipContents.COPIED));
822 * A FlipBufferStrategy for windows.
824 private class WindowFlipBufferStrategy extends FlipBufferStrategy
827 * Creates a flip buffer strategy for this window.
829 * @param numBuffers the number of buffers in this strategy
831 * @throws AWTException if the requested number of buffers is not
834 WindowFlipBufferStrategy(int numBuffers)
838 new BufferCapabilities(new ImageCapabilities(true),
839 new ImageCapabilities(true),
840 BufferCapabilities.FlipContents.COPIED));
845 * Creates a buffering strategy that manages how this window is
846 * repainted. This method attempts to create the optimum strategy
847 * based on the desired number of buffers. Hardware or software
848 * acceleration may be used.
850 * createBufferStrategy attempts different levels of optimization,
851 * but guarantees that some strategy with the requested number of
852 * buffers will be created even if it is not optimal. First it
853 * attempts to create a page flipping strategy, then an accelerated
854 * blitting strategy, then an unaccelerated blitting strategy.
856 * Calling this method causes any existing buffer strategy to be
859 * @param numBuffers the number of buffers in this strategy
861 * @throws IllegalArgumentException if requested number of buffers
863 * @throws IllegalStateException if this window is not displayable
867 public void createBufferStrategy(int numBuffers)
870 throw new IllegalArgumentException("Window.createBufferStrategy: number"
871 + " of buffers is less than one");
873 if (!isDisplayable())
874 throw new IllegalStateException("Window.createBufferStrategy: window is"
875 + " not displayable");
877 // try a flipping strategy
880 bufferStrategy = new WindowFlipBufferStrategy(numBuffers);
883 catch (AWTException e)
887 // try an accelerated blitting strategy
890 bufferStrategy = new WindowBltBufferStrategy(numBuffers, true);
892 catch (AWTException e)
896 // fall back to an unaccelerated blitting strategy
899 bufferStrategy = new WindowBltBufferStrategy(numBuffers, false);
901 catch (AWTException e)
907 * Creates a buffering strategy that manages how this window is
908 * repainted. This method attempts to create a strategy based on
909 * the specified capabilities and throws an exception if the
910 * requested strategy is not supported.
912 * Calling this method causes any existing buffer strategy to be
915 * @param numBuffers the number of buffers in this strategy
916 * @param caps the requested buffering capabilities
918 * @throws AWTException if the requested capabilities are not
920 * @throws IllegalArgumentException if requested number of buffers
921 * is less than one or if caps is null
925 public void createBufferStrategy(int numBuffers,
926 BufferCapabilities caps)
929 throw new IllegalArgumentException("Window.createBufferStrategy: number"
930 + " of buffers is less than one");
933 throw new IllegalArgumentException("Window.createBufferStrategy:"
934 + " capabilities object is null");
936 // a flipping strategy was requested
937 if (caps.isPageFlipping())
941 bufferStrategy = new WindowFlipBufferStrategy(numBuffers);
943 catch (AWTException e)
948 bufferStrategy = new WindowBltBufferStrategy(numBuffers, true);
952 * Returns the buffer strategy used by the window.
954 * @return the buffer strategy.
957 public BufferStrategy getBufferStrategy()
959 return bufferStrategy;
967 public void applyResourceBundle(ResourceBundle rb)
969 throw new Error ("Not implemented");
977 public void applyResourceBundle(String rbName)
979 ResourceBundle rb = ResourceBundle.getBundle(rbName, Locale.getDefault(),
980 ClassLoader.getSystemClassLoader());
982 applyResourceBundle(rb);
986 * Gets the AccessibleContext associated with this <code>Window</code>.
987 * The context is created, if necessary.
989 * @return the associated context
991 public AccessibleContext getAccessibleContext()
993 /* Create the context if this is the first request */
994 if (accessibleContext == null)
995 accessibleContext = new AccessibleAWTWindow();
996 return accessibleContext;
1000 * Get graphics configuration. The implementation for Window will
1001 * not ask any parent containers, since Window is a toplevel
1002 * window and not actually embedded in the parent component.
1004 public GraphicsConfiguration getGraphicsConfiguration()
1006 if (graphicsConfiguration != null) return graphicsConfiguration;
1007 if (peer != null) return peer.getGraphicsConfiguration();
1011 protected void processWindowFocusEvent(WindowEvent event)
1013 if (windowFocusListener != null)
1015 switch (event.getID ())
1017 case WindowEvent.WINDOW_GAINED_FOCUS:
1018 windowFocusListener.windowGainedFocus (event);
1021 case WindowEvent.WINDOW_LOST_FOCUS:
1022 windowFocusListener.windowLostFocus (event);
1034 protected void processWindowStateEvent(WindowEvent event)
1036 if (windowStateListener != null
1037 && event.getID () == WindowEvent.WINDOW_STATE_CHANGED)
1038 windowStateListener.windowStateChanged (event);
1042 * Returns whether this <code>Window</code> can get the focus or not.
1046 public final boolean isFocusableWindow ()
1048 if (getFocusableWindowState () == false)
1051 if (this instanceof Dialog
1052 || this instanceof Frame)
1055 // FIXME: Implement more possible cases for returning true.
1061 * Returns the value of the focusableWindowState property.
1065 public boolean getFocusableWindowState ()
1067 return focusableWindowState;
1071 * Sets the value of the focusableWindowState property.
1075 public void setFocusableWindowState (boolean focusableWindowState)
1077 this.focusableWindowState = focusableWindowState;
1080 // setBoundsCallback is needed so that when a user moves a window,
1081 // the Window's location can be updated without calling the peer's
1082 // setBounds method. When a user moves a window the peer window's
1083 // location is updated automatically and the windowing system sends
1084 // a message back to the application informing it of its updated
1085 // dimensions. We must update the AWT Window class with these new
1086 // dimensions. But we don't want to call the peer's setBounds
1087 // method, because the peer's dimensions have already been updated.
1088 // (Under X, having this method prevents Configure event loops when
1089 // moving windows: Component.setBounds -> peer.setBounds ->
1090 // postConfigureEvent -> Component.setBounds -> ... In some cases
1091 // Configure event loops cause windows to jitter back and forth
1093 void setBoundsCallback (int x, int y, int w, int h)
1095 if (this.x == x && this.y == y && width == w && height == h)
1098 boolean resized = width != w || height != h;
1099 boolean moved = this.x != x || this.y != y;
1104 if (resized && isShowing ())
1107 new ComponentEvent(this, ComponentEvent.COMPONENT_RESIZED);
1108 getToolkit().getSystemEventQueue().postEvent(ce);
1110 if (moved && isShowing ())
1113 new ComponentEvent(this, ComponentEvent.COMPONENT_MOVED);
1114 getToolkit().getSystemEventQueue().postEvent(ce);
1119 * Generate a unique name for this window.
1121 * @return A unique name for this window.
1123 String generateName()
1125 return "win" + getUniqueLong();
1128 private static synchronized long getUniqueLong()
1130 return next_window_number++;