1 /* 2 * @(#)WindowFocusListener.java 1.6 03/12/19 3 * 4 * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 5 * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. 6 */ 7 8 package java.awt.event; 9 10 import java.util.EventListener; 11 12 /** 13 * The listener interface for receiving <code>WindowEvents</code>, including 14 * <code>WINDOW_GAINED_FOCUS</code> and <code>WINDOW_LOST_FOCUS</code> events. 15 * The class that is interested in processing a <code>WindowEvent</code> 16 * either implements this interface (and 17 * all the methods it contains) or extends the abstract 18 * <code>WindowAdapter</code> class (overriding only the methods of interest). 19 * The listener object created from that class is then registered with a 20 * <code>Window</code> 21 * using the <code>Window</code>'s <code>addWindowFocusListener</code> method. 22 * When the <code>Window</code>'s 23 * status changes by virtue of it being opened, closed, activated, deactivated, 24 * iconified, or deiconified, or by focus being transfered into or out of the 25 * <code>Window</code>, the relevant method in the listener object is invoked, 26 * and the <code>WindowEvent</code> is passed to it. 27 * 28 * @author David Mendenhall 29 * @version 1.6, 12/19/03 30 * 31 * @see WindowAdapter 32 * @see WindowEvent 33 * @see <a HREF="http://java.sun.com/docs/books/tutorial/post1.0/ui/windowlistener.html">Tutorial: Writing a Window Listener</a> 34 * @see <a HREF="http://www.awl.com/cp/javaseries/jcl1_2.html">Reference: The Java Class Libraries (update file)</a> 35 * 36 * @since 1.4 37 */ 38 public interface WindowFocusListener extends EventListener { 39 40 /** 41 * Invoked when the Window is set to be the focused Window, which means 42 * that the Window, or one of its subcomponents, will receive keyboard 43 * events. 44 */ 45 public void windowGainedFocus(WindowEvent e); 46 47 /** 48 * Invoked when the Window is no longer the focused Window, which means 49 * that keyboard events will no longer be delivered to the Window or any of 50 * its subcomponents. 51 */ 52 public void windowLostFocus(WindowEvent e); 53 } 54