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

Full support for keyboard keys in KeyCode (currently, many "special keys" equal KeyCode.UNDEFINED when handling KeyEvents)


    • Type: Enhancement
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: fx2.0.2
    • Fix Version/s: tbd
    • Component/s: javafx
    • Labels:
    • Environment:

      Windows Vista SP2


      Please support the full range of keyboard keys, as shown here: http://msdn.microsoft.com/en-us/library/windows/desktop/dd375731.aspx (referred to as "the table" in the remainder of this description)

      On my laptop keyboard i have:
      several multimedia keys (Play/Pause, Stop, Previous track, Next track)
      an Fn-modifier key (which e.g. in combination with F8 mutes the sound)
      several other keys (e.g. to open the default browser/email client, to turn on/off WLAN functionality, ...)

      When using the simple Swing/AWT application in attachment (Swing.java), and pressing all these keys, I see that:
      most of them have a "rawCode" value that matches the hexadecimal value in the table: e.g. the Play/Pause key gives rawCode 179 (= 0xB3), pressing Fn+F8 gives rawCode 173 (= 0xAD), ...
      some of them have a "rawCode" value of 255 (e.g. the button to turn on/off WLAN functionality): in this case the "scancode" value is different & thus still allows the keys to be distinguished

      ( note: rawCode and scancode are private variables in java.awt.event.KeyEvent )

      So I would like the KeyCode enum to incorporate all values as defined in the table (there are still many keys not yet available in JavaFX KeyCode, like e.g. the LAUNCH_MAIL and BROWSER_HOME, that i have on my laptop keyboard), and for all keys to be mapped according to that table. For the keys with a "rawCode" of 255, it is acceptable to give KeyCode.UNDEFINED, but ideally KeyCode would provide a way to distinguish these keys as well (e.g. by providing a range of UNDEFINED_1, UNDEFINED_2, ...)

      One particular use-case where this feature would be very handy, is allowing special multimedia keys to operate a JavaFX MediaPlayer.




            • Assignee:
              avanelverjfx Anthony Vanelverdinghe (Inactive)
            • Votes:
              0 Vote for this issue
              4 Start watching this issue


              • Created: