java.lang.Object com.realtime.crossfire.jxclient.gui.keybindings.KeyBindingState
public class KeyBindingState
Manages the state for the key binding dialog.
Field Summary | |
---|---|
private CommandList |
commands
The commands to bind, or null to unbind. |
private KeyBindings |
keyBindings
The KeyBindings to modify. |
private KeyBindings |
keyBindings2
The KeyBindings to modify. |
private char |
keyChar
The key character. |
private int |
keyCode
The key code. |
private int |
modifiers
The modifiers. |
private int |
state
The dialog state: 0=waiting for initial key press, 1=waiting for key release. |
private int |
type
The type of key binding: -1=invalid, 0=key code ( keyCode and
modifiers are valid), 1=key char (keyChar is valid). |
Constructor Summary | |
---|---|
KeyBindingState(KeyBindings keyBindings,
KeyBindings keyBindings2,
CommandList commands)
Creates a new instance. |
Method Summary | |
---|---|
void |
keyPressed(int keyCode,
int modifiers)
Records a binding by key code. |
boolean |
keyReleased()
Records a key released event. |
void |
keyTyped(char keyChar)
Records a binding by key character. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
@Nullable private final CommandList commands
null
to unbind.
@Nullable private final KeyBindings keyBindings
KeyBindings
to modify.
@Nullable private final KeyBindings keyBindings2
KeyBindings
to modify.
private char keyChar
type
== 1
.
private int keyCode
type
== 0
.
private int modifiers
type
== 0
.
private int state
private int type
keyCode
and
modifiers
are valid), 1=key char (keyChar
is valid).
Constructor Detail |
---|
public KeyBindingState(@Nullable KeyBindings keyBindings, @Nullable KeyBindings keyBindings2, @Nullable CommandList commands)
keyBindings
- the KeyBindings
to modify; may be
null
when removing bindingskeyBindings2
- the KeyBindings
to modify; only used
when removing bindings; may be null
when removing bindingscommands
- the commands to bind, or null
to unbindMethod Detail |
---|
public void keyPressed(int keyCode, int modifiers)
keyCode
- the key code that was pressedmodifiers
- the bindings that are activepublic boolean keyReleased()
true
if the dialog has finished, or
false
if the dialog is still activepublic void keyTyped(char keyChar)
keyChar
- the key character that was typed