/[classpath]/classpath/java/awt/Window.java
ViewVC logotype

Diff of /classpath/java/awt/Window.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.12 by ericb, Mon May 6 02:43:17 2002 UTC revision 1.13 by ericb, Wed May 8 07:53:53 2002 UTC
# Line 1  Line 1 
1  /* Copyright (C) 1999, 2000, 2002  Free Software Foundation  /* Window.java --
2       Copyright (C) 1999, 2000, 2002 Free Software Foundation
    Copyright (C) 1999 Free Software Foundation, Inc.  
3    
4  This file is part of GNU Classpath.  This file is part of GNU Classpath.
5    
# Line 36  this exception to your version of the li Line 35  this exception to your version of the li
35  obligated to do so.  If you do not wish to do so, delete this  obligated to do so.  If you do not wish to do so, delete this
36  exception statement from your version. */  exception statement from your version. */
37    
38    
39  package java.awt;  package java.awt;
40    
41  import java.awt.event.WindowEvent;  import java.awt.event.WindowEvent;
42  import java.awt.event.WindowListener;  import java.awt.event.WindowListener;
43  import java.awt.peer.WindowPeer;  import java.awt.peer.WindowPeer;
# Line 145  public class Window extends Container Line 146  public class Window extends Container
146    public void addNotify()    public void addNotify()
147    {    {
148      if (peer == null)      if (peer == null)
149        peer = getToolkit ().createWindow (this);        peer = getToolkit().createWindow(this);
150      super.addNotify ();      super.addNotify();
151    }    }
152    
153    /**    /**
# Line 171  public class Window extends Container Line 172  public class Window extends Container
172    /**    /**
173     * Makes this window visible and brings it to the front.     * Makes this window visible and brings it to the front.
174     */     */
175    public void show ()    public void show()
176    {    {
177      if (peer == null)      if (peer == null)
178        addNotify();        addNotify();
# Line 206  public class Window extends Container Line 207  public class Window extends Container
207     * Sends this window to the back so that all other windows display in     * Sends this window to the back so that all other windows display in
208     * front of it.     * front of it.
209     */     */
210    public void toBack ()    public void toBack()
211    {    {
212      if (peer != null)      if (peer != null)
213        {        {
214          WindowPeer wp = (WindowPeer) peer;          WindowPeer wp = (WindowPeer) peer;
215          wp.toBack ();          wp.toBack();
216        }        }
217    }    }
218    
# Line 219  public class Window extends Container Line 220  public class Window extends Container
220     * Brings this window to the front so that it displays in front of     * Brings this window to the front so that it displays in front of
221     * any other windows.     * any other windows.
222     */     */
223    public void toFront ()    public void toFront()
224    {    {
225      if (peer != null)      if (peer != null)
226        {        {
227          WindowPeer wp = (WindowPeer) peer;          WindowPeer wp = (WindowPeer) peer;
228          wp.toFront ();          wp.toFront();
229        }        }
230    }    }
231    
# Line 238  public class Window extends Container Line 239  public class Window extends Container
239     */     */
240    public Toolkit getToolkit()    public Toolkit getToolkit()
241    {    {
242      return Toolkit.getDefaultToolkit ();          return Toolkit.getDefaultToolkit();    
243    }    }
244    
245    /**    /**
# Line 270  public class Window extends Container Line 271  public class Window extends Container
271     *     *
272     * @return The locale this window is configured for.     * @return The locale this window is configured for.
273     */     */
274    public Locale getLocale ()    public Locale getLocale()
275    {    {
276      return locale == null ? Locale.getDefault () : locale;      return locale == null ? Locale.getDefault() : locale;
277    }    }
278    
279    /*    /*
# Line 312  public class Window extends Container Line 313  public class Window extends Container
313     *     *
314     * @param listener The <code>WindowListener</code> to add.     * @param listener The <code>WindowListener</code> to add.
315     */     */
316    public synchronized void addWindowListener (WindowListener listener)    public synchronized void addWindowListener(WindowListener listener)
317    {    {
318      windowListener = AWTEventMulticaster.add (windowListener, listener);      windowListener = AWTEventMulticaster.add(windowListener, listener);
319    }    }
320    
321    /**    /**
# Line 323  public class Window extends Container Line 324  public class Window extends Container
324     *     *
325     * @param listener The <code>WindowListener</code> to remove.     * @param listener The <code>WindowListener</code> to remove.
326     */     */
327    public synchronized void removeWindowListener (WindowListener listener)    public synchronized void removeWindowListener(WindowListener listener)
328    {    {
329      windowListener = AWTEventMulticaster.remove (windowListener, listener);      windowListener = AWTEventMulticaster.remove(windowListener, listener);
330    }    }
331    
332    public synchronized WindowListener[] getWindowListeners()    public synchronized WindowListener[] getWindowListeners()
# Line 363  public class Window extends Container Line 364  public class Window extends Container
364     *     *
365     * @param event The event to process.     * @param event The event to process.
366     */     */
367    protected void processEvent (AWTEvent evt)    protected void processEvent(AWTEvent evt)
368    {    {
369      if (evt instanceof WindowEvent)      if (evt instanceof WindowEvent)
370        processWindowEvent ((WindowEvent) evt);        processWindowEvent((WindowEvent) evt);
371      else      else
372        super.processEvent (evt);        super.processEvent(evt);
373    }    }
374    
375    /**    /**
# Line 379  public class Window extends Container Line 380  public class Window extends Container
380     *     *
381     * @param event The event to process.     * @param event The event to process.
382     */     */
383    protected void processWindowEvent (WindowEvent evt)    protected void processWindowEvent(WindowEvent evt)
384    {    {
385      if (windowListener != null)      if (windowListener != null)
386        {        {
387          switch (evt.getID ())          switch (evt.getID())
388            {            {
389            case WindowEvent.WINDOW_ACTIVATED:            case WindowEvent.WINDOW_ACTIVATED:
390              windowListener.windowActivated (evt);              windowListener.windowActivated(evt);
391              break;              break;
392            case WindowEvent.WINDOW_CLOSED:            case WindowEvent.WINDOW_CLOSED:
393              windowListener.windowClosed (evt);              windowListener.windowClosed(evt);
394              break;              break;
395            case WindowEvent.WINDOW_CLOSING:            case WindowEvent.WINDOW_CLOSING:
396              windowListener.windowClosing (evt);              windowListener.windowClosing(evt);
397              break;              break;
398            case WindowEvent.WINDOW_DEACTIVATED:            case WindowEvent.WINDOW_DEACTIVATED:
399              windowListener.windowDeactivated (evt);              windowListener.windowDeactivated(evt);
400              break;              break;
401            case WindowEvent.WINDOW_DEICONIFIED:            case WindowEvent.WINDOW_DEICONIFIED:
402              windowListener.windowDeiconified (evt);              windowListener.windowDeiconified(evt);
403              break;              break;
404            case WindowEvent.WINDOW_ICONIFIED:            case WindowEvent.WINDOW_ICONIFIED:
405              windowListener.windowIconified (evt);              windowListener.windowIconified(evt);
406              break;              break;
407            case WindowEvent.WINDOW_OPENED:            case WindowEvent.WINDOW_OPENED:
408              windowListener.windowOpened (evt);              windowListener.windowOpened(evt);
409              break;              break;
410            }            }
411        }        }

Legend:
Removed from v.1.12  
changed lines
  Added in v.1.13

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26