1. /*
  2. * @(#)KeyListener.java 1.13 00/02/02
  3. *
  4. * Copyright 1996-2000 Sun Microsystems, Inc. All Rights Reserved.
  5. *
  6. * This software is the proprietary information of Sun Microsystems, Inc.
  7. * Use is subject to license terms.
  8. *
  9. */
  10. package java.awt.event;
  11. import java.util.EventListener;
  12. /**
  13. * The listener interface for receiving keyboard events (keystrokes).
  14. * The class that is interested in processing a keyboard event
  15. * either implements this interface (and all the methods it
  16. * contains) or extends the abstract <code>KeyAdapter</code> class
  17. * (overriding only the methods of interest).
  18. * <P>
  19. * The listener object created from that class is then registered with a
  20. * component using the component's <code>addKeyListener</code>
  21. * method. A keyboard event is generated when a key is pressed, released,
  22. * or typed (pressedn and released). The relevant method in the listener
  23. * object is then invoked, and the <code>KeyEvent</code> is passed to it.
  24. *
  25. * @author Carl Quinn
  26. * @version 1.13 02/02/00
  27. *
  28. * @see KeyAdapter
  29. * @see KeyEvent
  30. * @see <a href="http://java.sun.com/docs/books/tutorial/post1.0/ui/keylistener.html">Tutorial: Writing a Key Listener</a>
  31. * @see <a href="http://www.awl.com/cp/javaseries/jcl1_2.html">Reference: The Java Class Libraries (update file)</a>
  32. *
  33. * @since 1.1
  34. */
  35. public interface KeyListener extends EventListener {
  36. /**
  37. * Invoked when a key has been typed.
  38. * This event occurs when a key press is followed by a key release.
  39. */
  40. public void keyTyped(KeyEvent e);
  41. /**
  42. * Invoked when a key has been pressed.
  43. */
  44. public void keyPressed(KeyEvent e);
  45. /**
  46. * Invoked when a key has been released.
  47. */
  48. public void keyReleased(KeyEvent e);
  49. }