Class MouseEvent

Direct Known Subclasses:
DragEndEvent, DragStartEvent, DropEvent, JBStrapMouseEvent, ListGridHeaderClickEvent, ListGridHeaderDoubleClickEvent, ListGridRowClickEvent, ListGridRowDoubleClickEvent, NavigationEvent

public class MouseEvent extends BrowserEvent
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
  • Constructor Details

    • MouseEvent

      public MouseEvent()
  • Method Details

    • getScreenX

      public Long getScreenX()
      Gets the mouse cursor's horizontal coordinates relative to the screen
      Returns:
      The mouse cursor's horizontal coordinates relative to the screen
    • getScreenY

      public Long getScreenY()
      Gets the mouse cursor's vertical coordinates relative to the screen
      Returns:
      The mouse cursor's vertical coordinates relative to the screen
    • getClientX

      public Long 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

      public Long 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

      public Boolean 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, otherwise false
    • getShiftKey

      public Boolean 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, otherwise false
    • getAltKey

      public Boolean 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, otherwise false
    • getMetaKey

      public Boolean 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, otherwise false
    • getButton

      public Long 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
      Note: If using Internet Explorer 8 or earlier, the values are:

      • 1 : Left mouse button
      • 2 : Right mouse button
      • 4 : The mouse wheel/middle button
      Note: With a left handed mouse, the return values are switched

    • getButtons

      public Long 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
      Note: With a left handed mouse, the return values are switched

    • getPageX

      public Long 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

      public Long 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

      public Long 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

      public Long 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

      public Long 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

      public Long 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

      public Long 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
      Note: With a left handed mouse, the return values are switched