Skip to content

KeyState

final class KeyState
Package: dev.joid.lib.input.key · Module: core · Source: KeyState.java

Remembers which key each held place of the keyboard typed, so that a release and a held test use the key of its press.

The UI bridge registry keeps one KeyState: a press records its place and its key, and the release of that place reports the same key, even when the layout changed in between. Key.isDown reads it.

ReturnsSignatureSummary
KeyState()Creates a state in which no key is held.

ReturnsSignatureSummary
voidpress(Key physicalKey, Key key)Records that the place physicalKey went down and typed key.
Keyrelease(Key physicalKey)Forgets a place that went up and returns the key that its press typed, or the place itself when no press was recorded.
booleanisDown(Key key)If true, a key is held.
KeygetKey(Key physicalKey)Returns the key that a held place typed, or the place itself when it is not held.

KeyState()

Creates a state in which no key is held.

void press(Key physicalKey, Key key)

Records that the place physicalKey went down and typed key.

Key release(Key physicalKey)

Forgets a place that went up and returns the key that its press typed, or the place itself when no press was recorded.

boolean isDown(Key key)

If true, a key is held. For a key that depends on the layout, it tests every held place that typed it; for any other key, it asks the window bridge.

Key getKey(Key physicalKey)

Returns the key that a held place typed, or the place itself when it is not held.


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