1. /*
  2. * @(#)MouseAdapter.java 1.12 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 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. * @see MouseEvent
  31. * @see MouseListener
  32. * @see <a href="http://java.sun.com/docs/books/tutorial/post1.0/ui/mouselistener.html">Tutorial: Writing a Mouse Listener</a>
  33. * @see <a href="http://www.awl.com/cp/javaseries/jcl1_2.html">Reference: The Java Class Libraries (update file)</a>
  34. *
  35. * @version 1.8 08/02/97
  36. * @author Carl Quinn
  37. */
  38. public abstract class MouseAdapter implements MouseListener {
  39. /**
  40. * Invoked when the mouse has been clicked on a component.
  41. */
  42. public void mouseClicked(MouseEvent e) {}
  43. /**
  44. * Invoked when a mouse button has been pressed on a component.
  45. */
  46. public void mousePressed(MouseEvent e) {}
  47. /**
  48. * Invoked when a mouse button has been released on a component.
  49. */
  50. public void mouseReleased(MouseEvent e) {}
  51. /**
  52. * Invoked when the mouse enters a component.
  53. */
  54. public void mouseEntered(MouseEvent e) {}
  55. /**
  56. * Invoked when the mouse exits a component.
  57. */
  58. public void mouseExited(MouseEvent e) {}
  59. }