SWING - MouseMotionEvent Class


The interface MouseMotionEvent indicates a mouse action occurred in a component. This low-level event is generated by a component object when a mouse is dragged or moved.

Class Declaration

Following is the declaration for java.awt.event.MouseMotionEvent Class −

public class MouseMotionEvent
   extends InputEvent

Interface Methods

Sr.No. Method & Description

void mouseDragged(MouseEvent e)

Invoked when a mouse button is pressed on a component and then dragged.


void mouseMoved(MouseEvent e)

Invoked when the mouse cursor has been moved onto a component but no buttons have been pushed.

Methods Inherited

This interface inherits methods from the following classes −

  • java.awt.event.InputEvent
  • java.awt.event.ComponentEvent
  • java.awt.AWTEvent
  • java.util.EventObject
  • java.lang.Object