Package com.jbstrap.core.event
Class MouseEvent
java.lang.Object
com.jbstrap.core.event.BaseEvent
com.jbstrap.core.event.BrowserEvent
com.jbstrap.core.event.MouseEvent
- Direct Known Subclasses:
DragEndEvent
,DragStartEvent
,DropEvent
,JBStrapMouseEvent
,ListGridHeaderClickEvent
,ListGridHeaderDoubleClickEvent
,ListGridRowClickEvent
,ListGridRowDoubleClickEvent
,NavigationEvent
This class contains the data of the mouse event.
These are the following:
- The client on which the event occurred
- The ID of the component on which the event occurred
- The event type
- The instance of the component, on which the event occurred
- The event's unique ID
- If the ALT button was held down during the event
- If the CONTROL button was held down during the event
- If the Meta button was held down during the event
- If the SHIFT button was held down during the event
- Which mouse button was held down during the event
- The position of the mouse cursor, relative to the client area
- The position of the mouse cursor, relative to the previous MouseMove event
- The position of the mouse cursor, relative to the component area.
- The position of the mouse cursor, relative to the page
- The position of the mouse cursor, relative to the screen
- Since:
- 4.0
- Author:
- JBStrap
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionDetermines if the ALT key was held down when the event occurredDetermines which mouse button was pressed when the event occurred.Determines which mouse buttons were pressed when the event occurred.Gets the mouse cursor's horizontal coordinates relative to the client (current window)Gets the mouse cursor's vertical coordinates relative to the client (current window)Determines if the CONTROL key was held down when the event occurredDetermines if the Meta key was held down when the event occurredGets the horizontal coordinate of the mouse cursor relative to the position of the last mouse move eventGets the vertical coordinate of the mouse cursor relative to the position of the last mouse move eventReturns the horizontal coordinate of the mouse cursor, relative to the component areaReturns the vertical coordinate of the mouse cursor, relative to the component areagetPageX()
Returns the horizontal coordinate of the mouse cursor, relative to the documentgetPageY()
Returns the vertical coordinate of the mouse cursor, relative to the documentGets the mouse cursor's horizontal coordinates relative to the screenGets the mouse cursor's vertical coordinates relative to the screenDetermines if the SHIFT key was held down when the event occurredgetWhich()
Determines which mouse button was pressed when the event was triggered.Methods inherited from class com.jbstrap.core.event.BrowserEvent
fireEvent, getBubbles, getCancelable, getClientId, getComposed, getDefaultPrevented, getDetail, getEventPhase, getIsTrusted, getType
Methods inherited from class com.jbstrap.core.event.BaseEvent
getClient, getComponent, getEventId, getEventType, getSenderId
-
Constructor Details
-
MouseEvent
public MouseEvent()
-
-
Method Details
-
getScreenX
Gets the mouse cursor's horizontal coordinates relative to the screen- Returns:
- The mouse cursor's horizontal coordinates relative to the screen
-
getScreenY
Gets the mouse cursor's vertical coordinates relative to the screen- Returns:
- The mouse cursor's vertical coordinates relative to the screen
-
getClientX
Gets the mouse cursor's horizontal coordinates relative to the client (current window)- Returns:
- The mouse cursor's horizontal coordinates relative to the client (current window)
-
getClientY
Gets the mouse cursor's vertical coordinates relative to the client (current window)- Returns:
- The mouse cursor's vertical coordinates relative to the client (current window)
-
getCtrlKey
Determines if the CONTROL key was held down when the event occurred- Returns:
true
, if the CONTROL button was held down when the event occurred, otherwisefalse
-
getShiftKey
Determines if the SHIFT key was held down when the event occurred- Returns:
true
, if the SHIFT button was held down when the event occurred, otherwisefalse
-
getAltKey
Determines if the ALT key was held down when the event occurred- Returns:
true
, if the ALT button was held down when the event occurred, otherwisefalse
-
getMetaKey
Determines if the Meta key was held down when the event occurred- Returns:
true
, if the Meta button was held down when the event occurred, otherwisefalse
-
getButton
Determines which mouse button was pressed when the event occurred.- Returns:
The number corresponding to the pressed mouse button.
Possible values:- 0 : Left mouse button
- 1 : The mouse wheel/middle button
- 2 : Right mouse button
- 1 : Left mouse button
- 2 : Right mouse button
- 4 : The mouse wheel/middle button
-
getButtons
Determines which mouse buttons were pressed when the event occurred.- Returns:
The number corresponding to the pressed mouse button(s). If multiple buttons were pressed, then the number values will be added. (Ie: The left button was pressed (1) and the right button was pressed (2), then the returned value will be 3.
Possible values:- 1 : Left mouse button
- 2 : Right mouse button
- 4 : The mouse wheel/middle button
- 8 : The fourth mouse button, usually the "back" navigation button
- 16 : The fifth mouse button, usually the "forward" navigation button
-
getPageX
Returns the horizontal coordinate of the mouse cursor, relative to the document- Returns:
- The horizontal coordinate of the mouse cursor, relative to the document
-
getPageY
Returns the vertical coordinate of the mouse cursor, relative to the document- Returns:
- The vertical coordinate of the mouse cursor, relative to the document
-
getOffsetX
Returns the horizontal coordinate of the mouse cursor, relative to the component area- Returns:
- The horizontal coordinate of the mouse cursor, relative to the component area
-
getOffsetY
Returns the vertical coordinate of the mouse cursor, relative to the component area- Returns:
- The vertical coordinate of the mouse cursor, relative to the component area
-
getMovementX
Gets the horizontal coordinate of the mouse cursor relative to the position of the last mouse move event- Returns:
- The horizontal coordinate of the mouse cursor relative to the position of the last mouse move event
-
getMovementY
Gets the vertical coordinate of the mouse cursor relative to the position of the last mouse move event- Returns:
- The vertical coordinate of the mouse cursor relative to the position of the last mouse move event
-
getWhich
Determines which mouse button was pressed when the event was triggered.- Returns:
The number corresponding to the pressed mouse button.
Possible values:- 0 : No button was pressed
- 1 : Left mouse button
- 2 : The mouse wheel/middle button
- 3 : Right mouse button
-