1. /*
  2. * @(#)KeyAdapter.java 1.17 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 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>KeyEvent</code> listener
  14. * and override the methods for the events of interest. (If you implement the
  15. * <code>KeyListener</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>addKeyListener</code>
  21. * method. When a key is pressed, released, or typed,
  22. * the relevant method in the listener object is invoked,
  23. * and the <code>KeyEvent</code> is passed to it.
  24. *
  25. * @author Carl Quinn
  26. * @version 1.17 12/19/03
  27. *
  28. * @see KeyEvent
  29. * @see KeyListener
  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 abstract class KeyAdapter implements KeyListener {
  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. }