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