Spec-Zone.ru › OpenJavaFX 24

Class KeyBinding.Builder

java.lang.Object
jfx.incubator.scene.control.input.KeyBinding.Builder
Enclosing class:
KeyBinding
public static class KeyBinding.Builder extends Object
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 Type Method Description
KeyBinding.Builder alt()
Sets the alt key down condition (the option key on macOS).
KeyBinding build()
Creates a new KeyBinding instance from the current settings.
KeyBinding.Builder command()
Sets the command key down condition on macOS.
KeyBinding.Builder control()
Sets the control key down condition.
KeyBinding.Builder keyReleased()
Sets the KEY_RELEASED condition, clearing KEY_PRESSED and KEY_TYPED.
KeyBinding.Builder keyTyped()
Sets the KEY_TYPED condition, clearing KEY_PRESSED and KEY_RELEASED.
KeyBinding.Builder meta()
Sets the meta key down condition.
KeyBinding.Builder option()
Sets the option key down condition on macOS.
KeyBinding.Builder shift()
Sets the shift key down condition.
KeyBinding.Builder shortcut()
Sets the shortcut key down condition.

Methods declared in class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Method Details

keyReleased

public KeyBinding.Builder keyReleased()
Sets the KEY_RELEASED condition, clearing KEY_PRESSED and KEY_TYPED.
Returns:
the Builder instance

keyTyped

public KeyBinding.Builder keyTyped()
Sets the KEY_TYPED condition, clearing KEY_PRESSED and KEY_RELEASED.
Returns:
the Builder instance

alt

public KeyBinding.Builder alt()
Sets the alt key down condition (the option key on macOS).
Returns:
this Builder

command

public KeyBinding.Builder command()
Sets the command key down condition on macOS.

Setting this condition on non-macOS platforms will result in the build method returning null.

Returns:
this Builder

control

public KeyBinding.Builder control()
Sets the control key down condition.
Returns:
this Builder

meta

public KeyBinding.Builder meta()
Sets the meta key down condition.
Returns:
this Builder

option

public KeyBinding.Builder option()
Sets the option key down condition on macOS.

Setting this condition on non-macOS platforms will result in the build method returning null.

Returns:
this Builder

shift

public KeyBinding.Builder shift()
Sets the shift key down condition.
Returns:
this Builder

shortcut

public KeyBinding.Builder shortcut()
Sets the shortcut key down condition.
Returns:
this Builder

build

public KeyBinding build()
Creates a new KeyBinding instance from the current settings.
Returns:
a new key binding instance.

Report a bug or suggest an enhancement
Copyright © 2008, 2025, Oracle and/or its affiliates. All rights reserved.

© 2008, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from JavaFX API Documentation.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Java, JavaFX and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API