KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * @(#)MouseListener.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 import java.util.EventListener JavaDoc;
11
12 /**
13  * The listener interface for receiving "interesting" mouse events
14  * (press, release, click, enter, and exit) on a component.
15  * (To track mouse moves and mouse drags, use the
16  * <code>MouseMotionListener</code>.)
17  * <P>
18  * The class that is interested in processing a mouse event
19  * either implements this interface (and all the methods it
20  * contains) or extends the abstract <code>MouseAdapter</code> class
21  * (overriding only the methods of interest).
22  * <P>
23  * The listener object created from that class is then registered with a
24  * component using the component's <code>addMouseListener</code>
25  * method. A mouse event is generated when the mouse is pressed, released
26  * clicked (pressed and released). A mouse event is also generated when
27  * the mouse cursor enters or leaves a component. When a mouse event
28  * occurs, the relevant method in the listener object is invoked, and
29  * the <code>MouseEvent</code> is passed to it.
30  *
31  * @author Carl Quinn
32  * @version 1.17, 12/19/03
33  *
34  * @see MouseAdapter
35  * @see MouseEvent
36  * @see <a HREF="http://java.sun.com/docs/books/tutorial/post1.0/ui/mouselistener.html">Tutorial: Writing a Mouse Listener</a>
37  * @see <a HREF="http://www.awl.com/cp/javaseries/jcl1_2.html">Reference: The Java Class Libraries (update file)</a>
38  *
39  * @since 1.1
40  */

41 public interface MouseListener extends EventListener JavaDoc {
42
43     /**
44      * Invoked when the mouse button has been clicked (pressed
45      * and released) on a component.
46      */

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

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

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

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

67     public void mouseExited(MouseEvent JavaDoc e);
68 }
69
Popular Tags