Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8145308

Improved support for key combinations

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 8u60
    • javafx
    • None
    • Win 8, 64 Bit, JDK 8u66

      Some applications, particularly computer games, often have the need to detect whether key combinations are currently pressed.

      For example, in a computer game there might be the situation where RIGHT+UP has to be detected for player one to make his character jump, while player two is pressing A+S to make his character duck at the same time.

      There is no native support for this in JavaFX 8, so a workaround has to be applied (maintaining a set of currently pressed KeyCodes updated by event handlers for KEY_PRESSED / KEY_RELEASED). Unfortunately this workaround is frequently unstable. For example, on Windows 8 it does NEVER detect the combinations LEFT+UP+SPACE nor RIGHT+DOWN+SPACE -- which are typical for "jump left and strike" or "duck right and strike" in simple arcade games (a workaround is to use CTRL instead of SPACE, BTW).

      Hence, it would be a good idea to have an improved support for key combinations in JavaFX 9 or later. Without forestalling any possible solution, a proposal could be to find a more direct way to ask the operating system for the complete BitSet of currently pressed keys.

            Unassigned Unassigned
            mkarg Markus Karg
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: