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. package java.awt.event;
  8. /**
  9. * An abstract adapter class for receiving keyboard focus events.
  10. * The methods in this class are empty. This class exists as
  11. * convenience for creating listener objects.
  12. * <P>
  13. * Extend this class to create a <code>FocusEvent</code> listener
  14. * and override the methods for the events of interest. (If you implement the
  15. * <code>FocusListener</code> interface, you have to define all of
  16. * the methods in it. This abstract class defines null methods for them
  17. * all, so you can only have to define methods for events you care about.)
  18. * <P>
  19. * Create a listener object using the extended class and then register it with
  20. * a 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 is invoked,
  23. * and the <code>FocusEvent</code> is passed to it.
  24. *
  25. * @see FocusEvent
  26. * @see FocusListener
  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.16 12/19/03
  32. * @since 1.1
  33. */
  34. public abstract class FocusAdapter implements FocusListener {
  35. /**
  36. * Invoked when a component gains the keyboard focus.
  37. */
  38. public void focusGained(FocusEvent e) {}
  39. /**
  40. * Invoked when a component loses the keyboard focus.
  41. */
  42. public void focusLost(FocusEvent e) {}
  43. }