Class KeyBinding.Builder
java.lang.Object
jfx.incubator.scene.control.input.KeyBinding.Builder
- Enclosing class:
KeyBinding
A builder for
KeyBinding
objects.
By default, its build
method creates a key KEY_PRESSED
binding. This can be changed
by calling either keyReleased()
or keyTyped()
.
The builder pattern can be used when convenience methods such as
KeyBinding.control(KeyCode)
or
KeyBinding.shiftShortcut(KeyCode)
are not sufficient.
Example:
KeyBinding.builder(KeyCode.TAB).control().option().shift().build()
- Since:
- 24
-
Method Summary
Modifier and TypeMethodDescriptionalt()
Sets thealt
key down condition (theoption
key on macOS).build()
Creates a newKeyBinding
instance from the current settings.command()
Sets thecommand
key down condition on macOS.control()
Sets thecontrol
key down condition.Sets the KEY_RELEASED condition, clearing KEY_PRESSED and KEY_TYPED.keyTyped()
Sets the KEY_TYPED condition, clearing KEY_PRESSED and KEY_RELEASED.meta()
Sets themeta
key down condition.option()
Sets theoption
key down condition on macOS.shift()
Sets theshift
key down condition.shortcut()
Sets theshortcut
key down condition.
-
Method Details
-
keyReleased
Sets the KEY_RELEASED condition, clearing KEY_PRESSED and KEY_TYPED.- Returns:
- the Builder instance
-
keyTyped
Sets the KEY_TYPED condition, clearing KEY_PRESSED and KEY_RELEASED.- Returns:
- the Builder instance
-
alt
Sets thealt
key down condition (theoption
key on macOS).- Returns:
- this Builder
-
command
Sets thecommand
key down condition on macOS.Setting this condition on non-macOS platforms will result in the
build
method returningnull
.- Returns:
- this Builder
-
control
-
meta
-
option
Sets theoption
key down condition on macOS.Setting this condition on non-macOS platforms will result in the
build
method returningnull
.- Returns:
- this Builder
-
shift
-
shortcut
-
build
Creates a newKeyBinding
instance from the current settings.- Returns:
- a new key binding instance.
-