1. /*
  2. * @(#)KeyAdapter.java 1.11 01/11/29
  3. *
  4. * Copyright 2002 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 (pressed and released),
  22. * the relevant method in the listener object is invoked,
  23. * and the <code>KeyEvent</code> is passed to it.
  24. *
  25. * @see KeyEvent
  26. * @see KeyListener
  27. * @see <a href="http://java.sun.com/docs/books/tutorial/post1.0/ui/keylistener.html">Tutorial: Writing a Key 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. * @version 1.11 11/29/01
  31. * @author Carl Quinn
  32. */
  33. public abstract class KeyAdapter implements KeyListener {
  34. /**
  35. * Invoked when a key has been typed.
  36. * This event occurs when a key press is followed by a key release.
  37. */
  38. public void keyTyped(KeyEvent e) {}
  39. /**
  40. * Invoked when a key has been pressed.
  41. */
  42. public void keyPressed(KeyEvent e) {}
  43. /**
  44. * Invoked when a key has been released.
  45. */
  46. public void keyReleased(KeyEvent e) {}
  47. }