java.awt.event
Interface MouseMotionListener

All Superinterfaces:
EventListener sample code for java.util.EventListener definition code for java.util.EventListener
All Known Subinterfaces:
MouseInputListener sample code for javax.swing.event.MouseInputListener definition code for javax.swing.event.MouseInputListener
All Known Implementing Classes:
AWTEventMulticaster sample code for java.awt.AWTEventMulticaster definition code for java.awt.AWTEventMulticaster , BasicButtonListener sample code for javax.swing.plaf.basic.BasicButtonListener definition code for javax.swing.plaf.basic.BasicButtonListener , BasicComboPopup.InvocationMouseMotionHandler sample code for javax.swing.plaf.basic.BasicComboPopup.InvocationMouseMotionHandler definition code for javax.swing.plaf.basic.BasicComboPopup.InvocationMouseMotionHandler , BasicComboPopup.ListMouseMotionHandler sample code for javax.swing.plaf.basic.BasicComboPopup.ListMouseMotionHandler definition code for javax.swing.plaf.basic.BasicComboPopup.ListMouseMotionHandler , BasicDesktopIconUI.MouseInputHandler sample code for javax.swing.plaf.basic.BasicDesktopIconUI.MouseInputHandler definition code for javax.swing.plaf.basic.BasicDesktopIconUI.MouseInputHandler , BasicInternalFrameUI.BorderListener sample code for javax.swing.plaf.basic.BasicInternalFrameUI.BorderListener definition code for javax.swing.plaf.basic.BasicInternalFrameUI.BorderListener , BasicInternalFrameUI.GlassPaneDispatcher sample code for javax.swing.plaf.basic.BasicInternalFrameUI.GlassPaneDispatcher definition code for javax.swing.plaf.basic.BasicInternalFrameUI.GlassPaneDispatcher , BasicListUI.MouseInputHandler sample code for javax.swing.plaf.basic.BasicListUI.MouseInputHandler definition code for javax.swing.plaf.basic.BasicListUI.MouseInputHandler , BasicMenuItemUI.MouseInputHandler sample code for javax.swing.plaf.basic.BasicMenuItemUI.MouseInputHandler definition code for javax.swing.plaf.basic.BasicMenuItemUI.MouseInputHandler , BasicMenuUI.MouseInputHandler sample code for javax.swing.plaf.basic.BasicMenuUI.MouseInputHandler definition code for javax.swing.plaf.basic.BasicMenuUI.MouseInputHandler , BasicScrollBarUI.TrackListener sample code for javax.swing.plaf.basic.BasicScrollBarUI.TrackListener definition code for javax.swing.plaf.basic.BasicScrollBarUI.TrackListener , BasicSliderUI.TrackListener sample code for javax.swing.plaf.basic.BasicSliderUI.TrackListener definition code for javax.swing.plaf.basic.BasicSliderUI.TrackListener , BasicSplitPaneDivider.MouseHandler sample code for javax.swing.plaf.basic.BasicSplitPaneDivider.MouseHandler definition code for javax.swing.plaf.basic.BasicSplitPaneDivider.MouseHandler , BasicTableHeaderUI.MouseInputHandler sample code for javax.swing.plaf.basic.BasicTableHeaderUI.MouseInputHandler definition code for javax.swing.plaf.basic.BasicTableHeaderUI.MouseInputHandler , BasicTableUI.MouseInputHandler sample code for javax.swing.plaf.basic.BasicTableUI.MouseInputHandler definition code for javax.swing.plaf.basic.BasicTableUI.MouseInputHandler , BasicTextUI.BasicCaret sample code for javax.swing.plaf.basic.BasicTextUI.BasicCaret definition code for javax.swing.plaf.basic.BasicTextUI.BasicCaret , BasicToolBarUI.DockingListener sample code for javax.swing.plaf.basic.BasicToolBarUI.DockingListener definition code for javax.swing.plaf.basic.BasicToolBarUI.DockingListener , BasicTreeUI.MouseHandler sample code for javax.swing.plaf.basic.BasicTreeUI.MouseHandler definition code for javax.swing.plaf.basic.BasicTreeUI.MouseHandler , BasicTreeUI.MouseInputHandler sample code for javax.swing.plaf.basic.BasicTreeUI.MouseInputHandler definition code for javax.swing.plaf.basic.BasicTreeUI.MouseInputHandler , DefaultCaret sample code for javax.swing.text.DefaultCaret definition code for javax.swing.text.DefaultCaret , HTMLEditorKit.LinkController sample code for javax.swing.text.html.HTMLEditorKit.LinkController definition code for javax.swing.text.html.HTMLEditorKit.LinkController , MetalToolBarUI.MetalDockingListener sample code for javax.swing.plaf.metal.MetalToolBarUI.MetalDockingListener definition code for javax.swing.plaf.metal.MetalToolBarUI.MetalDockingListener , MouseDragGestureRecognizer sample code for java.awt.dnd.MouseDragGestureRecognizer definition code for java.awt.dnd.MouseDragGestureRecognizer , MouseInputAdapter sample code for javax.swing.event.MouseInputAdapter definition code for javax.swing.event.MouseInputAdapter , MouseMotionAdapter sample code for java.awt.event.MouseMotionAdapter definition code for java.awt.event.MouseMotionAdapter , ToolTipManager sample code for javax.swing.ToolTipManager definition code for javax.swing.ToolTipManager

public interface MouseMotionListener
extends EventListener sample code for java.util.EventListener definition code for java.util.EventListener

The listener interface for receiving mouse motion events on a component. (For clicks and other mouse events, use the MouseListener.)

The class that is interested in processing a mouse motion event either implements this interface (and all the methods it contains) or extends the abstract MouseMotionAdapter class (overriding only the methods of interest).

The listener object created from that class is then registered with a component using the component's addMouseMotionListener method. A mouse motion event is generated when the mouse is moved or dragged. (Many such events will be generated). When a mouse motion event occurs, the relevant method in the listener object is invoked, and the MouseEvent is passed to it.

Since:
1.1
See Also:
MouseMotionAdapter sample code for java.awt.event.MouseMotionAdapter definition code for java.awt.event.MouseMotionAdapter , MouseEvent sample code for java.awt.event.MouseEvent definition code for java.awt.event.MouseEvent , Tutorial: Writing a Mouse Motion Listener, Reference: The Java Class Libraries (update file)

Method Summary
 void mouseDragged sample code for java.awt.event.MouseMotionListener.mouseDragged(java.awt.event.MouseEvent) definition code for java.awt.event.MouseMotionListener.mouseDragged(java.awt.event.MouseEvent) (MouseEvent sample code for java.awt.event.MouseEvent definition code for java.awt.event.MouseEvent  e)
          Invoked when a mouse button is pressed on a component and then dragged.
 void mouseMoved sample code for java.awt.event.MouseMotionListener.mouseMoved(java.awt.event.MouseEvent) definition code for java.awt.event.MouseMotionListener.mouseMoved(java.awt.event.MouseEvent) (MouseEvent sample code for java.awt.event.MouseEvent definition code for java.awt.event.MouseEvent  e)
          Invoked when the mouse cursor has been moved onto a component but no buttons have been pushed.
 

Method Detail

mouseDragged sample code for java.awt.event.MouseMotionListener.mouseDragged(java.awt.event.MouseEvent) definition code for java.awt.event.MouseMotionListener.mouseDragged(java.awt.event.MouseEvent)

void mouseDragged(MouseEvent sample code for java.awt.event.MouseEvent definition code for java.awt.event.MouseEvent  e)
Invoked when a mouse button is pressed on a component and then dragged. MOUSE_DRAGGED events will continue to be delivered to the component where the drag originated until the mouse button is released (regardless of whether the mouse position is within the bounds of the component).

Due to platform-dependent Drag&Drop implementations, MOUSE_DRAGGED events may not be delivered during a native Drag&Drop operation.


mouseMoved sample code for java.awt.event.MouseMotionListener.mouseMoved(java.awt.event.MouseEvent) definition code for java.awt.event.MouseMotionListener.mouseMoved(java.awt.event.MouseEvent)

void mouseMoved(MouseEvent sample code for java.awt.event.MouseEvent definition code for java.awt.event.MouseEvent  e)
Invoked when the mouse cursor has been moved onto a component but no buttons have been pushed.