public abstract class Keyboard
extends java.lang.Object
Keyboard.KeyEvent is emitted indicating the logical key that
was depressed. Keyboard.TypedEvent is emitted to inform the app of the typed character. The
typed character will account for whether the shift key is depressed and will be appropriately
mapped to the uppercase equivalent or the appropriate alternate character (for example, # for 3,
in the US keyboard layout). The typed event is delivered immediately after the pressed event.
Keyboard.KeyEvent is emitted, indicating the logical key that was
released. | Modifier and Type | Class and Description |
|---|---|
static class |
Keyboard.Event
The base class for all keyboard events.
|
static class |
Keyboard.KeyEvent
An event dispatched for key press/release.
|
static class |
Keyboard.KeySlot
A slot which only dispatches on
Keyboard.KeyEvents. |
static class |
Keyboard.TextType
Enumerates the different available mobile keyboard types.
|
static class |
Keyboard.TypedEvent
An event dispatched when a printable character is typed.
|
static class |
Keyboard.TypedSlot
A slot which only dispatches on
Keyboard.TypedEvents. |
| Constructor and Description |
|---|
Keyboard() |
| Modifier and Type | Method and Description |
|---|---|
static Function<Keyboard.Event,Keyboard.KeyEvent> |
isKey(Key key)
Returns a collector function for key events for
key. |
static Keyboard.KeyEvent |
isKey(Key key,
Keyboard.Event event)
A collector function for key events for
key. |
static Keyboard.KeyEvent |
keyEvents(Keyboard.Event event)
Checks whether
event is a KeyEvent and returns it (casted appropriately) if
so. |
static Keyboard.TypedEvent |
typedEvents(Keyboard.Event event)
Checks whether
event is a TypedEvent and returns it (casted appropriately) if
so. |
public static Keyboard.KeyEvent keyEvents(Keyboard.Event event)
event is a KeyEvent and returns it (casted appropriately) if
so. Returns null otherwise. Use it to obtain only key events like so:
Input.keyboardEvents.collect(Keyboard::keyEvents).connect(event -> {
// handle key events here (event has type KeyEvent)
});
public static Keyboard.TypedEvent typedEvents(Keyboard.Event event)
event is a TypedEvent and returns it (casted appropriately) if
so. Returns null otherwise. Use it to obtain only typed events like so:
Input.keyboardEvents.collect(Keyboard::typedEvents).connect(event -> {
// handle typed events here (event has type TypedEvent)
});
public static Keyboard.KeyEvent isKey(Key key, Keyboard.Event event)
key. Use it to obtain only events for a
particular key like so:
Input.keyboardEvents.collect(ev -> Keyboard.isKey(Key.X, ev)).connect(event -> {
// handle the 'x' key being pressed or released
});
public static Function<Keyboard.Event,Keyboard.KeyEvent> isKey(Key key)
key. Use it to obtain only events for
a particular key like so:
Input.keyboardEvents.collect(Keyboard.isKey(Key.X)).connect(event -> {
// handle the 'x' key being pressed or released
});
Copyright © 2018. All Rights Reserved.