home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 November / Chip_1998-11_cd.bin / tema / Cafe / main.bin / WindowEvent.java < prev    next >
Text File  |  1997-05-20  |  4KB  |  142 lines

  1. /*
  2.  * @(#)WindowEvent.java    1.11 97/01/27
  3.  * 
  4.  * Copyright (c) 1996 Sun Microsystems, Inc. All Rights Reserved.
  5.  * 
  6.  * This software is the confidential and proprietary information of Sun
  7.  * Microsystems, Inc. ("Confidential Information").  You shall not
  8.  * disclose such Confidential Information and shall use it only in
  9.  * accordance with the terms of the license agreement you entered into
  10.  * with Sun.
  11.  * 
  12.  * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
  13.  * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  14.  * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  15.  * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
  16.  * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
  17.  * THIS SOFTWARE OR ITS DERIVATIVES.
  18.  * 
  19.  * CopyrightVersion 1.1_beta
  20.  * 
  21.  */
  22.  
  23. package java.awt.event;
  24.  
  25. import java.awt.Event;
  26. import java.awt.Window;
  27.  
  28. /**
  29.  * The window-level event.
  30.  *
  31.  * @version 1.11 01/27/97
  32.  * @author Carl Quinn
  33.  * @author Amy Fowler
  34.  */
  35. public class WindowEvent extends ComponentEvent {
  36.  
  37.     /**
  38.      * Marks the first integer id for the range of window event ids.
  39.      */
  40.     public static final int WINDOW_FIRST        = 200;
  41.  
  42.     /**
  43.      * Marks the last integer id for the range of window event ids.
  44.      */
  45.     public static final int WINDOW_LAST         = 206;
  46.  
  47.     /**
  48.      * The window opened event type.  This event is delivered only
  49.      * the first time a window is made visible.
  50.      */
  51.     public static final int WINDOW_OPENED    = WINDOW_FIRST; // 200
  52.  
  53.     /**
  54.      * The window closing event type. This event is delivered when
  55.      * the user selects "Quit" from the window's system menu.  If
  56.      * the program does not explicitly hide or destroy the window as
  57.      * a result of this event, the window close operation will be
  58.      * cancelled.
  59.      */
  60.     public static final int WINDOW_CLOSING    = 1 + WINDOW_FIRST; //Event.WINDOW_DESTROY
  61.  
  62.     /**
  63.      * The window closed event type. This event is delivered after
  64.      * the window has been closed as the result of a call to hide or
  65.      * destroy.
  66.      */
  67.     public static final int WINDOW_CLOSED    = 2 + WINDOW_FIRST;
  68.  
  69.     /**
  70.      * The window iconified event type.
  71.      */
  72.     public static final int WINDOW_ICONIFIED    = 3 + WINDOW_FIRST; //Event.WINDOW_ICONIFY
  73.  
  74.     /**
  75.      * The window deiconified event type.
  76.      */
  77.     public static final int WINDOW_DEICONIFIED    = 4 + WINDOW_FIRST; //Event.WINDOW_DEICONIFY
  78.  
  79.     /**
  80.      * The window activated event type.
  81.      */
  82.     public static final int WINDOW_ACTIVATED    = 5 + WINDOW_FIRST;
  83.  
  84.     /**
  85.      * The window deactivated event type.
  86.      */
  87.     public static final int WINDOW_DEACTIVATED    = 6 + WINDOW_FIRST;
  88.  
  89.     /*
  90.      * JDK 1.1 serialVersionUID 
  91.      */
  92.      private static final long serialVersionUID = -1567959133147912127L;
  93.  
  94.     /**
  95.      * Constructs a WindowEvent object with the specified source window 
  96.      * and type.
  97.      * @param source the component where the event originated
  98.      * @id the event type
  99.      */
  100.     public WindowEvent(Window source, int id) {
  101.         super(source, id);
  102.     }
  103.  
  104.     /**
  105.      * Returns the window where this event originated.
  106.      */
  107.     public Window getWindow() {
  108.         return (source instanceof Window) ? (Window)source : null;
  109.     } 
  110.  
  111.     public String paramString() {
  112.         String typeStr;
  113.         switch(id) {
  114.           case WINDOW_OPENED:
  115.               typeStr = "WINDOW_OPENED";
  116.               break;
  117.           case WINDOW_CLOSING:
  118.               typeStr = "WINDOW_CLOSING";
  119.               break;
  120.           case WINDOW_CLOSED:
  121.               typeStr = "WINDOW_CLOSED";
  122.               break;
  123.           case WINDOW_ICONIFIED:
  124.               typeStr = "WINDOW_ICONIFIED";
  125.               break;
  126.           case WINDOW_DEICONIFIED:
  127.               typeStr = "WINDOW_DEICONIFIED";
  128.               break;
  129.           case WINDOW_ACTIVATED:
  130.               typeStr = "WINDOW_ACTIVATED";
  131.               break;
  132.           case WINDOW_DEACTIVATED:
  133.               typeStr = "WINDOW_DEACTIVATED";
  134.               break;
  135.           default:
  136.               typeStr = "unknown type";
  137.         }
  138.         return typeStr;
  139.     }
  140.  
  141. }
  142.