java.lang.Object
is.codion.swing.common.ui.key.KeyEvents
A factory for key event builders.
JTextField textField = new JTextField();
KeyEvents.builder(VK_DOWN)
.onKeyRelease(false)
.modifiers(CTRL_DOWN_MASK)
.condition(WHEN_FOCUSED)
.action(new FindNextAction())
.enable(textField);
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
A Builder for adding a key event to a component, with a default onKeyRelease trigger and conditionJComponent.WHEN_FOCUSED
. -
Method Summary
Modifier and TypeMethodDescriptionstatic KeyEvents.Builder
builder()
Instantiates a newKeyEvents.Builder
instance.static KeyEvents.Builder
builder
(int keyCode) Instantiates a newKeyEvents.Builder
instance.static KeyEvents.Builder
Instantiates a newKeyEvents.Builder
instance.static KeyStroke
keyStroke
(int keyCode) Creates aKeyStroke
with the given keyCode and no modifiers.static KeyStroke
keyStroke
(int keyCode, int modifiers) Creates aKeyStroke
with the given keyCode and modifiers.
-
Method Details
-
builder
Instantiates a newKeyEvents.Builder
instance. Note that an Action must be set viaKeyEvents.Builder.action(Action)
before enabling/disabling.- Returns:
- a
KeyEvents.Builder
instance.
-
builder
Instantiates a newKeyEvents.Builder
instance. Note that an Action must be set viaKeyEvents.Builder.action(Action)
before enabling/disabling.- Parameters:
keyCode
- the key code- Returns:
- a
KeyEvents.Builder
instance.
-
builder
Instantiates a newKeyEvents.Builder
instance. Note that an Action must be set viaKeyEvents.Builder.action(Action)
before enabling/disabling.- Parameters:
keyStroke
- the key stroke- Returns:
- a
KeyEvents.Builder
instance.
-
keyStroke
Creates aKeyStroke
with the given keyCode and no modifiers.- Parameters:
keyCode
- the key code- Returns:
- a keystroke value
- See Also:
-
keyStroke
Creates aKeyStroke
with the given keyCode and modifiers.- Parameters:
keyCode
- the key codemodifiers
- the modifiers- Returns:
- a keystroke value
- See Also:
-