Class MouseMoveEvent


public class MouseMoveEvent extends MouseEvent
Represents a mouse movement event that occurs when a user moves the mouse pointer over an element.

This event is fired continuously as the user moves the mouse pointer while it is positioned over an element. It extends MouseEvent to inherit coordinate tracking capabilities and is dispatched to registered MouseListener instances for processing.

Features:

  • Tracks mouse pointer movement with client coordinates
  • Inherits X and Y coordinate tracking from MouseEvent
  • Fires continuously during mouse movement
  • Integrates with the mouse event listener pattern

Usage:


 // Create a mouse move event at coordinates (300, 400)
 MouseMoveEvent event = new MouseMoveEvent(300, 400);

 // Access inherited coordinate getters
 int x = event.getClientX(); // Returns 300
 int y = event.getClientY(); // Returns 400

 // Dispatch to a listener for tracking mouse position
 event.dispatchTo(myMouseListener);
 
Since:
2016
Version:
1.0
Author:
Marvin P. Warble Jr.
See Also:
  • Constructor Details

    • MouseMoveEvent

      public MouseMoveEvent(int clientX, int clientY)
      Constructs a new MouseMoveEvent with the specified client coordinates.
      Parameters:
      clientX - the X coordinate of the mouse pointer relative to the client viewport
      clientY - the Y coordinate of the mouse pointer relative to the client viewport
  • Method Details

    • dispatchTo

      public void dispatchTo(MouseClickListener listener)
      Dispatches this event to the specified listener for processing.

      This method invokes the listener's onEvent method with this event instance, allowing the listener to handle the mouse movement event.

      Specified by:
      dispatchTo in class Event<MouseClickListener>
      Parameters:
      listener - the listener to which this event should be dispatched