Two Laptop Bag
The moose likes JavaFX and the fly likes Standard key sequences Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JavaFX
Bookmark "Standard key sequences" Watch "Standard key sequences" New topic

Standard key sequences

Stefan K Larsson

Joined: Jul 09, 2014
Posts: 10
I am looking for something in JavaFX 8 which corresponds to standard key sequences in Qt which returns standard key combinations depending on the current operating system.

See the corresponding Qt-documentation:

I have not been able to find anything similar in the JavaFX 8 documentation.
John Damien Smith
Ranch Hand

Joined: Jan 26, 2012
Posts: 227
I suggest creating a feature request for defining standard key combinations in the JavaFX issue tracker.

That way, when Behaviors are made public they can make use of the standard key combination API.

JavaFX has a behavior system to model platform specific behaviors such as key events and mouse events. The behavior API is currently private and will (likely) be exposed as a public API in a future JavaFX release (after it has undergone, more development, modification and review). The key bindings in the behaviors are the closest thing to the standard key combinations you refer to. You can see how some key bindings are defined in the ListViewBehavior. Many of the standard bindings defined in QT are to do with text input bindings, so the equivalent of those is the TextInputBinding. Be aware that because classes like TextInputBinding are not supported public API, they will be subject to change without notice in future JavaFX versions.

Some common keys like next track, previous track, volume up, volume down, etc, are defined in the existing KeyCombination class.

There is a special KeyCode called SHORTCUT, it is defined as below:

> This common shortcut modifier is a modifier key which is used commonly in shortcuts on the host platform. It is for example control on Windows and meta (command key) on Mac.

In the meantime define your own KeyCombinations for different platforms and switch between them as appropriate, making use of SHORTCUT to make it easier to get expected cross-platform behaviour.
Stefan K Larsson

Joined: Jul 09, 2014
Posts: 10
Thank you for your insights. I filed an issue in Jira #RT-37936.
I agree. Here's the link:
subject: Standard key sequences
It's not a secret anymore!