Class MouseEvent
java.lang.Object
com.oorian.messaging.events.Event<MouseClickListener>
com.oorian.messaging.events.client.ClientEvent<MouseClickListener>
com.oorian.messaging.events.client.MouseEvent
- Direct Known Subclasses:
ContextMenuEvent,MouseDblClickedEvent,MouseDownEvent,MouseEnterEvent,MouseLeaveEvent,MouseMoveEvent,MouseOutEvent,MouseOverEvent,MouseUpEvent
Abstract base class for all mouse-related events in the client interface.
This class serves as the foundation for specific mouse event types, providing common functionality for tracking the coordinates of mouse interactions. All mouse events capture the X and Y positions of the mouse pointer relative to the client viewport at the time the event occurs.
Features:
- Provides coordinate tracking for all mouse events
- Extends the generic client event framework
- Serves as a base for specialized mouse event types
- Integrates with the MouseListener interface
Usage:
// Subclass to create specific mouse events
public class CustomMouseEvent extends MouseEvent {
public CustomMouseEvent(int clientX, int clientY) {
super(clientX, clientY);
}
{@literal @}Override
public void dispatchTo(MouseListener listener) {
// Custom dispatch logic
}
}
// Use inherited coordinate getters
MouseEvent event = new MouseDownEvent(100, 200);
int x = event.getClientX(); // Returns 100
int y = event.getClientY(); // Returns 200
- Since:
- 2007
- Version:
- 1.0
- Author:
- Marvin P. Warble Jr.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionMouseEvent(int clientX, int clientY) Constructs a new MouseEvent with the specified client coordinates. -
Method Summary
Modifier and TypeMethodDescriptionintReturns 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, setTargetMethods inherited from class com.oorian.messaging.events.Event
bubbles, dispatchTo
-
Constructor Details
-
MouseEvent
public MouseEvent(int clientX, int clientY) Constructs a new MouseEvent 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 mouse event
-
getClientY
public int getClientY()Returns the Y coordinate of the mouse pointer relative to the client viewport.- Returns:
- the Y coordinate of the mouse event
-