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.
Description
Section titled “Description”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.
Learn more
Section titled “Learn more”Creation
Section titled “Creation”| Returns | Signature | Summary |
|---|---|---|
| KeyState() | Creates a state in which no key is held. |
Methods
Section titled “Methods”| Returns | Signature | Summary |
|---|---|---|
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. |
Key | getKey(Key physicalKey) | Returns the key that a held place typed, or the place itself when it is not held. |
Creation details
Section titled “Creation details”KeyState
Section titled “KeyState”KeyState()
Creates a state in which no key is held.
Method details
Section titled “Method details”void press(Key physicalKey, Key key)
Records that the place physicalKey went down and typed key.
release
Section titled “release”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.
isDown
Section titled “isDown”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.
getKey
Section titled “getKey”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
