1 /* 2 * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package java.awt.event; 27 28 import java.util.EventListener; 29 30 /** 31 * The listener interface for receiving mouse motion events on a component. 32 * (For clicks and other mouse events, use the <code>MouseListener</code>.) 33 * <P> 34 * The class that is interested in processing a mouse motion event 35 * either implements this interface (and all the methods it 36 * contains) or extends the abstract <code>MouseMotionAdapter</code> class 37 * (overriding only the methods of interest). 38 * <P> 39 * The listener object created from that class is then registered with a 40 * component using the component's <code>addMouseMotionListener</code> 41 * method. A mouse motion event is generated when the mouse is moved 42 * or dragged. (Many such events will be generated). When a mouse motion event 43 * occurs, the relevant method in the listener object is invoked, and 44 * the <code>MouseEvent</code> is passed to it. 45 * 46 * @author Amy Fowler 47 * 48 * @see MouseMotionAdapter 49 * @see MouseEvent 50 * @see <a href="http://java.sun.com/docs/books/tutorial/post1.0/ui/mousemotionlistener.html">Tutorial: Writing a Mouse Motion Listener</a> 51 * 52 * @since 1.1 53 */ 54 public interface MouseMotionListener extends EventListener { 55 56 /** 57 * Invoked when a mouse button is pressed on a component and then 58 * dragged. <code>MOUSE_DRAGGED</code> events will continue to be 59 * delivered to the component where the drag originated until the 60 * mouse button is released (regardless of whether the mouse position 61 * is within the bounds of the component). 62 * <p> 63 * Due to platform-dependent Drag&Drop implementations, 64 * <code>MOUSE_DRAGGED</code> events may not be delivered during a native 65 * Drag&Drop operation. 66 */ 67 public void mouseDragged(MouseEvent e); 68 69 /** 70 * Invoked when the mouse cursor has been moved onto a component 71 * but no buttons have been pushed. 72 */ 73 public void mouseMoved(MouseEvent e); 74 75 }