Class MouseClickedEvent
java.lang.Object
com.oorian.messaging.events.Event<MouseClickListener>
com.oorian.messaging.events.client.ClientEvent<MouseClickListener>
com.oorian.messaging.events.client.MouseClickedEvent
Represents a mouse click event that occurs when a user clicks on an element in the client interface.
This event captures the coordinates of the mouse pointer at the time of the click, providing
information about where the user clicked within the client viewport. The event is dispatched
to registered MouseClickListener instances for processing.
Features:
- Captures client X and Y coordinates of the mouse click
- Extends the generic client event framework
- Integrates with the event listener pattern for handling user interactions
Usage:
// Create a mouse click event at coordinates (100, 200)
MouseClickedEvent event = new MouseClickedEvent(100, 200);
// Get the click coordinates
int x = event.getClientX(); // Returns 100
int y = event.getClientY(); // Returns 200
// Dispatch to a listener
event.dispatchTo(myMouseClickListener);
- Since:
- 2016
- Version:
- 1.0
- Author:
- Marvin P. Warble Jr.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionMouseClickedEvent(int clientX, int clientY) Constructs a new MouseClickedEvent with the specified client coordinates. -
Method Summary
Modifier and TypeMethodDescriptionvoiddispatchTo(MouseClickListener listener) Dispatches this event to the specified listener for processing.intReturns the X coordinate of the mouse pointer relative to the client viewport.intReturns the Y coordinate of the mouse pointer relative to the client viewport.Methods inherited from class com.oorian.messaging.events.client.ClientEvent
getSource, getTarget, setSource, setTarget
-
Constructor Details
-
MouseClickedEvent
public MouseClickedEvent(int clientX, int clientY) Constructs a new MouseClickedEvent with the specified client coordinates.- Parameters:
clientX- the X coordinate of the mouse pointer relative to the client viewportclientY- the Y coordinate of the mouse pointer relative to the client viewport
-
-
Method Details
-
getClientX
public int getClientX()Returns the X coordinate of the mouse pointer relative to the client viewport.- Returns:
- the X coordinate of the click event
-
getClientY
public int getClientY()Returns the Y coordinate of the mouse pointer relative to the client viewport.- Returns:
- the Y coordinate of the click event
-
dispatchTo
Dispatches this event to the specified listener for processing.This method invokes the listener's
onEventmethod with this event instance, allowing the listener to handle the mouse click event.- Specified by:
dispatchToin classEvent<MouseClickListener>- Parameters:
listener- the listener to which this event should be dispatched
-