1. /*
  2. * @(#)MouseAdapter.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 mouse events.
  10. * The methods in this class are empty. This class exists as
  11. * convenience for creating listener objects.
  12. * <P>
  13. * Mouse events let you track when a mouse is pressed, released, clicked,
  14. * when it enters a component, and when it exits.
  15. * (To track mouse moves and mouse drags, use the MouseMotionAdapter.)
  16. * <P>
  17. * Extend this class to create a <code>MouseEvent</code> listener
  18. * and override the methods for the events of interest. (If you implement the
  19. * <code>MouseListener</code> interface, you have to define all of
  20. * the methods in it. This abstract class defines null methods for them
  21. * all, so you can only have to define methods for events you care about.)
  22. * <P>
  23. * Create a listener object using the extended class and then register it with
  24. * a component using the component's <code>addMouseListener</code>
  25. * method. When a mouse button is pressed, released, or clicked (pressed and
  26. * released), or when the mouse cursor enters or exits the component,
  27. * the relevant method in the listener object is invoked
  28. * and the <code>MouseEvent</code> is passed to it.
  29. *
  30. * @author Carl Quinn
  31. * @version 1.8 08/02/97
  32. *
  33. * @see MouseEvent
  34. * @see MouseListener
  35. * @see <a href="http://java.sun.com/docs/books/tutorial/post1.0/ui/mouselistener.html">Tutorial: Writing a Mouse Listener</a>
  36. * @see <a href="http://www.awl.com/cp/javaseries/jcl1_2.html">Reference: The Java Class Libraries (update file)</a>
  37. *
  38. * @since 1.1
  39. */
  40. public abstract class MouseAdapter implements MouseListener {
  41. /**
  42. * Invoked when the mouse has been clicked on a component.
  43. */
  44. public void mouseClicked(MouseEvent e) {}
  45. /**
  46. * Invoked when a mouse button has been pressed on a component.
  47. */
  48. public void mousePressed(MouseEvent e) {}
  49. /**
  50. * Invoked when a mouse button has been released on a component.
  51. */
  52. public void mouseReleased(MouseEvent e) {}
  53. /**
  54. * Invoked when the mouse enters a component.
  55. */
  56. public void mouseEntered(MouseEvent e) {}
  57. /**
  58. * Invoked when the mouse exits a component.
  59. */
  60. public void mouseExited(MouseEvent e) {}
  61. }