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.
Description
Section titled “Description”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.
Learn more
Section titled “Learn more”Creation
Section titled “Creation”| Returns | Signature | Summary |
|---|---|---|
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. |
Methods
Section titled “Methods”| Returns | Signature | Summary |
|---|---|---|
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). |
Values
Section titled “Values”| Value | Summary |
|---|---|
LEFT | The primary button, number 0. |
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. |
Creation details
Section titled “Creation details”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.
Method details
Section titled “Method details”isLeft
Section titled “isLeft”boolean isLeft()
Returns true for MouseButton.LEFT.
isRight
Section titled “isRight”boolean isRight()
Returns true for MouseButton.RIGHT.
isMiddle
Section titled “isMiddle”boolean isMiddle()
Returns true for MouseButton.MIDDLE.
isBack
Section titled “isBack”boolean isBack()
Returns true for MouseButton.BACK.
isForward
Section titled “isForward”boolean isForward()
Returns true for MouseButton.FORWARD.
isOther
Section titled “isOther”boolean isOther()
Returns true for MouseButton.OTHER.
getButton
Section titled “getButton”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.
Value details
Section titled “Value details”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
Section titled “MIDDLE”MIDDLE
The wheel button, number 2.
BACK
The side button that a browser maps to “back”, number 3.
FORWARD
Section titled “FORWARD”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
