1/*
2 * Copyright (c) 1996, 2013, 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
26package java.awt.event;
27
28import 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} 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}
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} is passed to it.
42 *
43 * @author Carl Quinn
44 *
45 * @see WindowAdapter
46 * @see WindowEvent
47 * @see <a href="http://docs.oracle.com/javase/tutorial/uiswing/events/windowlistener.html">Tutorial: How to Write Window Listeners</a>
48 *
49 * @since 1.1
50 */
51public interface WindowListener extends EventListener {
52    /**
53     * Invoked the first time a window is made visible.
54     * @param e the event to be processed
55     */
56    public void windowOpened(WindowEvent e);
57
58    /**
59     * Invoked when the user attempts to close the window
60     * from the window's system menu.
61     * @param e the event to be processed
62     */
63    public void windowClosing(WindowEvent e);
64
65    /**
66     * Invoked when a window has been closed as the result
67     * of calling dispose on the window.
68     * @param e the event to be processed
69     */
70    public void windowClosed(WindowEvent e);
71
72    /**
73     * Invoked when a window is changed from a normal to a
74     * minimized state. For many platforms, a minimized window
75     * is displayed as the icon specified in the window's
76     * iconImage property.
77     * @param e the event to be processed
78     * @see java.awt.Frame#setIconImage
79     */
80    public void windowIconified(WindowEvent e);
81
82    /**
83     * Invoked when a window is changed from a minimized
84     * to a normal state.
85     * @param e the event to be processed
86     */
87    public void windowDeiconified(WindowEvent e);
88
89    /**
90     * Invoked when the Window is set to be the active Window. Only a Frame or
91     * a Dialog can be the active Window. The native windowing system may
92     * denote the active Window or its children with special decorations, such
93     * as a highlighted title bar. The active Window is always either the
94     * focused Window, or the first Frame or Dialog that is an owner of the
95     * focused Window.
96     * @param e the event to be processed
97     */
98    public void windowActivated(WindowEvent e);
99
100    /**
101     * Invoked when a Window is no longer the active Window. Only a Frame or a
102     * Dialog can be the active Window. The native windowing system may denote
103     * the active Window or its children with special decorations, such as a
104     * highlighted title bar. The active Window is always either the focused
105     * Window, or the first Frame or Dialog that is an owner of the focused
106     * Window.
107     * @param e the event to be processed
108     */
109    public void windowDeactivated(WindowEvent e);
110}
111