Class MouseDownEvent


public class MouseDownEvent extends MouseEvent
Represents a mouse button press (down) event that occurs when a user presses a mouse button over an element.

This event is fired when the user presses down on a mouse button while the pointer is over an element, before the button is released. It extends MouseEvent to inherit coordinate tracking capabilities and is dispatched to registered MouseListener instances for processing.

Features:

  • Captures mouse button press with client coordinates
  • Inherits X and Y coordinate tracking from MouseEvent
  • Part of the mouse interaction lifecycle (down, move, up)
  • Integrates with the mouse event listener pattern

Usage:


 // Create a mouse down event at coordinates (200, 300)
 MouseDownEvent event = new MouseDownEvent(200, 300);

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

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

    • MouseDownEvent

      public MouseDownEvent(int clientX, int clientY)
      Constructs a new MouseDownEvent 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 button press event.

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