KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > java > awt > event > MouseAdapter


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
8 package java.awt.event;
9
10 /**
11  * An abstract adapter class for receiving mouse events.
12  * The methods in this class are empty. This class exists as
13  * convenience for creating listener objects.
14  * <P>
15  * Mouse events let you track when a mouse is pressed, released, clicked,
16  * when it enters a component, and when it exits.
17  * (To track mouse moves and mouse drags, use the MouseMotionAdapter.)
18  * <P>
19  * Extend this class to create a <code>MouseEvent</code> listener
20  * and override the methods for the events of interest. (If you implement the
21  * <code>MouseListener</code> interface, you have to define all of
22  * the methods in it. This abstract class defines null methods for them
23  * all, so you can only have to define methods for events you care about.)
24  * <P>
25  * Create a listener object using the extended class and then register it with
26  * a component using the component's <code>addMouseListener</code>
27  * method. When a mouse button is pressed, released, or clicked (pressed and
28  * released), or when the mouse cursor enters or exits the component,
29  * the relevant method in the listener object is invoked
30  * and the <code>MouseEvent</code> is passed to it.
31  *
32  * @author Carl Quinn
33  * @version 1.8 08/02/97
34  *
35  * @see MouseEvent
36  * @see MouseListener
37  * @see <a HREF="http://java.sun.com/docs/books/tutorial/post1.0/ui/mouselistener.html">Tutorial: Writing a Mouse Listener</a>
38  * @see <a HREF="http://www.awl.com/cp/javaseries/jcl1_2.html">Reference: The Java Class Libraries (update file)</a>
39  *
40  * @since 1.1
41  */

42 public abstract class MouseAdapter implements MouseListener JavaDoc {
43     /**
44      * Invoked when the mouse has been clicked on a component.
45      */

46     public void mouseClicked(MouseEvent JavaDoc e) {}
47
48     /**
49      * Invoked when a mouse button has been pressed on a component.
50      */

51     public void mousePressed(MouseEvent JavaDoc e) {}
52
53     /**
54      * Invoked when a mouse button has been released on a component.
55      */

56     public void mouseReleased(MouseEvent JavaDoc e) {}
57
58     /**
59      * Invoked when the mouse enters a component.
60      */

61     public void mouseEntered(MouseEvent JavaDoc e) {}
62
63     /**
64      * Invoked when the mouse exits a component.
65      */

66     public void mouseExited(MouseEvent JavaDoc e) {}
67 }
68
Popular Tags