1. /*
  2. * @(#)KeyAdapter.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. /**
  12. * An abstract adapter class for receiving keyboard events.
  13. * The methods in this class are empty. This class exists as
  14. * convenience for creating listener objects.
  15. * <P>
  16. * Extend this class to create a <code>KeyEvent</code> listener
  17. * and override the methods for the events of interest. (If you implement the
  18. * <code>KeyListener</code> interface, you have to define all of
  19. * the methods in it. This abstract class defines null methods for them
  20. * all, so you can only have to define methods for events you care about.)
  21. * <P>
  22. * Create a listener object using the extended class and then register it with
  23. * a component using the component's <code>addKeyListener</code>
  24. * method. When a key is pressed, released, or typed (pressed and released),
  25. * the relevant method in the listener object is invoked,
  26. * and the <code>KeyEvent</code> is passed to it.
  27. *
  28. * @author Carl Quinn
  29. * @version 1.13 02/02/00
  30. *
  31. * @see KeyEvent
  32. * @see KeyListener
  33. * @see <a href="http://java.sun.com/docs/books/tutorial/post1.0/ui/keylistener.html">Tutorial: Writing a Key Listener</a>
  34. * @see <a href="http://www.awl.com/cp/javaseries/jcl1_2.html">Reference: The Java Class Libraries (update file)</a>
  35. *
  36. * @since 1.1
  37. */
  38. public abstract class KeyAdapter implements KeyListener {
  39. /**
  40. * Invoked when a key has been typed.
  41. * This event occurs when a key press is followed by a key release.
  42. */
  43. public void keyTyped(KeyEvent e) {}
  44. /**
  45. * Invoked when a key has been pressed.
  46. */
  47. public void keyPressed(KeyEvent e) {}
  48. /**
  49. * Invoked when a key has been released.
  50. */
  51. public void keyReleased(KeyEvent e) {}
  52. }