Skip to content
Reference > Classes

MouseEvent

Definition

MouseEvent var = .... ;

Extends

Extended By

None

Method Summary

Owner Name Return Type Description
MouseEvent getAltKeyDown() Boolean Returns true if the alt key was pressed during the mouse event.
MouseEvent getButton() String Returns LEFT, MIDDLE or RIGHT.
Object getClassName() String Returns the string name of this object's class type.
MouseEvent getCtrlKeyDown() Boolean Returns true if the ctrl key was pressed during the mouse event.
MouseEvent getEvent() String Returns the type of mouse event. The available types (code) are CLICK (0), CONTEXTMENU (1), DOUBLECLICK (2), MOUSE DOWN (3), or MOUSE UP (4). Note that each mouse click will fire this 3 times (mouse down -> mouse up -> click)
MouseEvent getPosition() Point Returns the absolute x, y position.
MouseEvent getRelativePosition(panel) Point Returns the x,y position relative to a panel. Typically, in the onMouse(...) callback you would do: Point p=event.getRelativePosition(this);
MouseEvent getShiftKeyDown() Boolean Returns true if the shift key was pressed during the mouse event.
MouseEvent getX() Integer Returns the absolute x position. Same as getPosition().getX()
MouseEvent getY() Integer Returns the absolute y position. Same as getPosition().getY()
Object toJson() String Returns a json representation of this object.

Method Definitions


getAltKeyDown()

Boolean MouseEvent::getAltKeyDown()

Description

Returns true if the alt key was pressed during the mouse event.


getButton()

String MouseEvent::getButton()

Description

Returns LEFT, MIDDLE or RIGHT.


getCtrlKeyDown()

Boolean MouseEvent::getCtrlKeyDown()

Description

Returns true if the ctrl key was pressed during the mouse event.


getEvent()

String MouseEvent::getEvent()

Description

Returns the type of mouse event. The available types (code) are CLICK (0), CONTEXTMENU (1), DOUBLECLICK (2), MOUSE DOWN (3), or MOUSE UP (4). Note that each mouse click will fire this 3 times (mouse down -> mouse up -> click)


getPosition()

Point MouseEvent::getPosition()

Description

Returns the absolute x, y position.


getRelativePosition(panel)

Point MouseEvent::getRelativePosition(Panel panel)

Description

Returns the x,y position relative to a panel. Typically, in the onMouse(...) callback you would do: Point p=event.getRelativePosition(this);

Parameter Definition

Name Type Description
panel Panel  panel to get the relative position from

getShiftKeyDown()

Boolean MouseEvent::getShiftKeyDown()

Description

Returns true if the shift key was pressed during the mouse event.


getX()

Integer MouseEvent::getX()

Description

Returns the absolute x position. Same as getPosition().getX()


getY()

Integer MouseEvent::getY()

Description

Returns the absolute y position. Same as getPosition().getY()