1 /*
   2  * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package java.awt.event;
  27 
  28 import java.util.EventListener;
  29 
  30 /**
  31  * The listener interface for receiving window events.
  32  * The class that is interested in processing a window event
  33  * either implements this interface (and all the methods it
  34  * contains) or extends the abstract <code>WindowAdapter</code> class
  35  * (overriding only the methods of interest).
  36  * The listener object created from that class is then registered with a
  37  * Window using the window's <code>addWindowListener</code>
  38  * method. When the window's status changes by virtue of being opened,
  39  * closed, activated or deactivated, iconified or deiconified,
  40  * the relevant method in the listener object is invoked, and the
  41  * <code>WindowEvent</code> is passed to it.
  42  *
  43  * @author Carl Quinn
  44  *
  45  * @see WindowAdapter
  46  * @see WindowEvent
  47  * @see <a href="http://java.sun.com/docs/books/tutorial/uiswing/events/windowlistener.html">Tutorial: How to Write Window Listeners</a>
  48  *
  49  * @since 1.1
  50  */
  51 public interface WindowListener extends EventListener {
  52     /**
  53      * Invoked the first time a window is made visible.
  54      */
  55     public void windowOpened(WindowEvent e);
  56 
  57     /**
  58      * Invoked when the user attempts to close the window
  59      * from the window's system menu.
  60      */
  61     public void windowClosing(WindowEvent e);
  62 
  63     /**
  64      * Invoked when a window has been closed as the result
  65      * of calling dispose on the window.
  66      */
  67     public void windowClosed(WindowEvent e);
  68 
  69     /**
  70      * Invoked when a window is changed from a normal to a
  71      * minimized state. For many platforms, a minimized window
  72      * is displayed as the icon specified in the window's
  73      * iconImage property.
  74      * @see java.awt.Frame#setIconImage
  75      */
  76     public void windowIconified(WindowEvent e);
  77 
  78     /**
  79      * Invoked when a window is changed from a minimized
  80      * to a normal state.
  81      */
  82     public void windowDeiconified(WindowEvent e);
  83 
  84     /**
  85      * Invoked when the Window is set to be the active Window. Only a Frame or
  86      * a Dialog can be the active Window. The native windowing system may
  87      * denote the active Window or its children with special decorations, such
  88      * as a highlighted title bar. The active Window is always either the
  89      * focused Window, or the first Frame or Dialog that is an owner of the
  90      * focused Window.
  91      */
  92     public void windowActivated(WindowEvent e);
  93 
  94     /**
  95      * Invoked when a Window is no longer the active Window. Only a Frame or a
  96      * Dialog can be the active Window. The native windowing system may denote
  97      * the active Window or its children with special decorations, such as a
  98      * highlighted title bar. The active Window is always either the focused
  99      * Window, or the first Frame or Dialog that is an owner of the focused
 100      * Window.
 101      */
 102     public void windowDeactivated(WindowEvent e);
 103 }