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 thealtkey down condition (theoptionkey on macOS).build()Creates a newKeyBindinginstance from the current settings.command()Sets thecommandkey down condition on macOS.control()Sets thecontrolkey 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 themetakey down condition.option()Sets theoptionkey down condition on macOS.shift()Sets theshiftkey down condition.shortcut()Sets theshortcutkey 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 thealtkey down condition (theoptionkey on macOS).- Returns:
- this Builder
-
command
Sets thecommandkey down condition on macOS.Setting this condition on non-macOS platforms will result in the
buildmethod returningnull.- Returns:
- this Builder
-
control
-
meta
-
option
Sets theoptionkey down condition on macOS.Setting this condition on non-macOS platforms will result in the
buildmethod returningnull.- Returns:
- this Builder
-
shift
-
shortcut
-
build
Creates a newKeyBindinginstance from the current settings.- Returns:
- a new key binding instance.
-