1 /* 2 * @(#)FocusAdapter.java 1.16 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 /** 11 * An abstract adapter class for receiving keyboard focus events. 12 * The methods in this class are empty. This class exists as 13 * convenience for creating listener objects. 14 * <P> 15 * Extend this class to create a <code>FocusEvent</code> listener 16 * and override the methods for the events of interest. (If you implement the 17 * <code>FocusListener</code> interface, you have to define all of 18 * the methods in it. This abstract class defines null methods for them 19 * all, so you can only have to define methods for events you care about.) 20 * <P> 21 * Create a listener object using the extended class and then register it with 22 * a component using the component's <code>addFocusListener</code> 23 * method. When the component gains or loses the keyboard focus, 24 * the relevant method in the listener object is invoked, 25 * and the <code>FocusEvent</code> is passed to it. 26 * 27 * @see FocusEvent 28 * @see FocusListener 29 * @see <a HREF="http://java.sun.com/docs/books/tutorial/post1.0/ui/focuslistener.html">Tutorial: Writing a Focus Listener</a> 30 * @see <a HREF="http://www.awl.com/cp/javaseries/jcl1_2.html">Reference: The Java Class Libraries (update file)</a> 31 * 32 * @author Carl Quinn 33 * @version 1.16 12/19/03 34 * @since 1.1 35 */ 36 public abstract class FocusAdapter implements FocusListener { 37 /** 38 * Invoked when a component gains the keyboard focus. 39 */ 40 public void focusGained(FocusEvent e) {} 41 42 /** 43 * Invoked when a component loses the keyboard focus. 44 */ 45 public void focusLost(FocusEvent e) {} 46 } 47