Skip to content

MouseButton

enum MouseButton
Package: dev.joid.lib.input.mouse · Module: core · Source: MouseButton.java

A mouse button, as the mouse events of nodes and UIs report it.

Every mouse event holds the button that sent it: NodeMouseEvent.getButton on a node, UIMouseEvent.getButton on a UI. Test it with the isX() predicates, for example to open a context menu on a right press only.

ReturnsSignatureSummary
MouseButtonof(int button) factoryReturns the button of a button number of the window library: 0 left, 1 right, 2 middle, 3 back, 4 forward.

ReturnsSignatureSummary
booleanisLeft()Returns true for MouseButton.LEFT.
booleanisRight()Returns true for MouseButton.RIGHT.
booleanisMiddle()Returns true for MouseButton.MIDDLE.
booleanisBack()Returns true for MouseButton.BACK.
booleanisForward()Returns true for MouseButton.FORWARD.
booleanisOther()Returns true for MouseButton.OTHER.
intgetButton()Returns the button number of this button, the inverse of of(int).
ValueSummary
LEFTThe primary button, number 0.
RIGHTThe secondary button, number 1.
MIDDLEThe wheel button, number 2.
BACKThe side button that a browser maps to “back”, number 3.
FORWARDThe side button that a browser maps to “forward”, number 4.
OTHERAny button beyond the first five; JOID does not tell them apart.

MouseButton of(int button) factory

Returns the button of a button number of the window library: 0 left, 1 right, 2 middle, 3 back, 4 forward. Any other number gives MouseButton.OTHER.

boolean isLeft()

Returns true for MouseButton.LEFT.

boolean isRight()

Returns true for MouseButton.RIGHT.

boolean isMiddle()

Returns true for MouseButton.MIDDLE.

boolean isBack()

Returns true for MouseButton.BACK.

boolean isForward()

Returns true for MouseButton.FORWARD.

boolean isOther()

Returns true for MouseButton.OTHER.

int getButton()

Returns the button number of this button, the inverse of of(int). MouseButton.OTHER returns -1, because it stands for every other number.

LEFT

The primary button, number 0. Node.onClick, the controls and the drag of a node answer this button only.

RIGHT

The secondary button, number 1.

MIDDLE

The wheel button, number 2.

BACK

The side button that a browser maps to “back”, number 3.

FORWARD

The side button that a browser maps to “forward”, number 4.

OTHER

Any button beyond the first five; JOID does not tell them apart.


fluent returns the instance, typed for chaining · factory creates an instance · signal also accepts a value that follows signals, as a signal, an expression or a lambda (When does JOID compute this value again?) · hook called by JOID, override it · abstract you implement it · default interface method with a body · static called on the class · protected visible to subclasses

Report a problem with this page