1 /* 2 * @(#)MouseMotionListener.java 1.15 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; 11 12 /** 13 * The listener interface for receiving mouse motion events on a component. 14 * (For clicks and other mouse events, use the <code>MouseListener</code>.) 15 * <P> 16 * The class that is interested in processing a mouse motion event 17 * either implements this interface (and all the methods it 18 * contains) or extends the abstract <code>MouseMotionAdapter</code> class 19 * (overriding only the methods of interest). 20 * <P> 21 * The listener object created from that class is then registered with a 22 * component using the component's <code>addMouseMotionListener</code> 23 * method. A mouse motion event is generated when the mouse is moved 24 * or dragged. (Many such events will be generated). When a mouse motion event 25 * occurs, the relevant method in the listener object is invoked, and 26 * the <code>MouseEvent</code> is passed to it. 27 * 28 * @author Amy Fowler 29 * @version 1.15, 12/19/03 30 * 31 * @see MouseMotionAdapter 32 * @see MouseEvent 33 * @see <a HREF="http://java.sun.com/docs/books/tutorial/post1.0/ui/mousemotionlistener.html">Tutorial: Writing a Mouse Motion Listener</a> 34 * @see <a HREF="http://www.awl.com/cp/javaseries/jcl1_2.html">Reference: The Java Class Libraries (update file)</a> 35 * 36 * @since 1.1 37 */ 38 public interface MouseMotionListener extends EventListener { 39 40 /** 41 * Invoked when a mouse button is pressed on a component and then 42 * dragged. <code>MOUSE_DRAGGED</code> events will continue to be 43 * delivered to the component where the drag originated until the 44 * mouse button is released (regardless of whether the mouse position 45 * is within the bounds of the component). 46 * <p> 47 * Due to platform-dependent Drag&Drop implementations, 48 * <code>MOUSE_DRAGGED</code> events may not be delivered during a native 49 * Drag&Drop operation. 50 */ 51 public void mouseDragged(MouseEvent e); 52 53 /** 54 * Invoked when the mouse cursor has been moved onto a component 55 * but no buttons have been pushed. 56 */ 57 public void mouseMoved(MouseEvent e); 58 59 } 60