home *** CD-ROM | disk | FTP | other *** search
/ Java 1.2 How-To / JavaHowTo.iso / 3rdParty / jbuilder / unsupported / JDK1.2beta3 / SOURCE / SRC.ZIP / java / awt / event / MouseAdapter.java < prev    next >
Encoding:
Java Source  |  1998-03-20  |  2.6 KB  |  73 lines

  1. /*
  2.  * @(#)MouseAdapter.java    1.10 98/03/18
  3.  *
  4.  * Copyright 1996, 1997 by Sun Microsystems, Inc.,
  5.  * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
  6.  * All rights reserved.
  7.  *
  8.  * This software is the confidential and proprietary information
  9.  * of Sun Microsystems, Inc. ("Confidential Information").  You
  10.  * shall not disclose such Confidential Information and shall use
  11.  * it only in accordance with the terms of the license agreement
  12.  * you entered into with Sun.
  13.  */
  14.  
  15. package java.awt.event;
  16.  
  17. /**
  18.  * An abstract adapter class for receiving mouse events.
  19.  * The methods in this class are empty. This class exists as
  20.  * convenience for creating listener objects.
  21.  * <P>
  22.  * Mouse events let you track when a mouse is pressed, released, clicked, 
  23.  * when it enters a component, and when it exits.
  24.  * (To track mouse moves and mouse drags, use the MouseMotionAdapter.)
  25.  * <P>
  26.  * Extend this class to create a <code>MouseEvent</code> listener 
  27.  * and override the methods for the events of interest. (If you implement the 
  28.  * <code>MouseListener</code> interface, you have to define all of
  29.  * the methods in it. This abstract class defines null methods for them
  30.  * all, so you can only have to define methods for events you care about.)
  31.  * <P>
  32.  * Create a listener object using the extended class and then register it with 
  33.  * a component using the component's <code>addMouseListener</code> 
  34.  * method. When a mouse button is pressed, released, or clicked (pressed and
  35.  * released), or when the mouse cursor enters or exits the component,
  36.  * the relevant method in the listener object is invoked
  37.  * and the <code>MouseEvent</code> is passed to it.
  38.  *
  39.  * @see MouseEvent 
  40.  * @see MouseListener
  41.  * @see <a href="http://java.sun.com/docs/books/tutorial/post1.0/ui/mouselistener.html">Tutorial: Writing a Mouse Listener</a>
  42.  * @see <a href="http://www.awl.com/cp/javaseries/jcl1_2.html">Reference: The Java Class Libraries (update file)</a>
  43.  *
  44.  * @version 1.8 08/02/97
  45.  * @author Carl Quinn
  46.  */
  47. public abstract class MouseAdapter implements MouseListener {
  48.     /**
  49.      * Invoked when the mouse has been clicked on a component.
  50.      */
  51.     public void mouseClicked(MouseEvent e) {}
  52.  
  53.     /**
  54.      * Invoked when a mouse button has been pressed on a component.
  55.      */
  56.     public void mousePressed(MouseEvent e) {}
  57.  
  58.     /**
  59.      * Invoked when a mouse button has been released on a component.
  60.      */
  61.     public void mouseReleased(MouseEvent e) {}
  62.  
  63.     /**
  64.      * Invoked when the mouse enters a component.
  65.      */
  66.     public void mouseEntered(MouseEvent e) {}
  67.  
  68.     /**
  69.      * Invoked when the mouse exits a component.
  70.      */
  71.     public void mouseExited(MouseEvent e) {}
  72. }
  73.