1 /* 2 * @(#)FocusListener.java 1.15 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 keyboard focus events on 14 * a component. 15 * The class that is interested in processing a focus event 16 * either implements this interface (and all the methods it 17 * contains) or extends the abstract <code>FocusAdapter</code> class 18 * (overriding only the methods of interest). 19 * The listener object created from that class is then registered with a 20 * component using the component's <code>addFocusListener</code> 21 * method. When the component gains or loses the keyboard focus, 22 * the relevant method in the listener object 23 * is invoked, and the <code>FocusEvent</code> is passed to it. 24 * 25 * @see FocusAdapter 26 * @see FocusEvent 27 * @see <a HREF="http://java.sun.com/docs/books/tutorial/post1.0/ui/focuslistener.html">Tutorial: Writing a Focus Listener</a> 28 * @see <a HREF="http://www.awl.com/cp/javaseries/jcl1_2.html">Reference: The Java Class Libraries (update file)</a> 29 * 30 * @author Carl Quinn 31 * @version 1.15 12/19/03 32 * @since 1.1 33 */ 34 public interface FocusListener extends EventListener { 35 36 /** 37 * Invoked when a component gains the keyboard focus. 38 */ 39 public void focusGained(FocusEvent e); 40 41 /** 42 * Invoked when a component loses the keyboard focus. 43 */ 44 public void focusLost(FocusEvent e); 45 } 46