According to the JavaDoc for KeyEvent's getText() method, it returns
A String describing the key code, such as "HOME", "F1" or "A", for key pressed and key released events. For key typed events, text is always the empty string.
However, when I try printing getText(), it works as expected for printable characters, but not for other keys. "a" and "A" are the results for pressing the a and Shift-A keys, but pressing the Home, F1, or arrow keys results in "". Similarly, it registers the pressing of the Shift key before the A key when I press Shift-A, but the getText() for Shift is "".
Strangely enough, pressing Ctrl + some key produces a non-printable control key.
Is this a bug, or at least a mismatch between the docs and the real behavior? I am using ScalaFX, so I suppose there could be a problem in the Scala interface, but I'm actually using the javafx.scene.input.KeyEvent and javafx.event.EventHandler classes, not their Scala wrappers, so I doubt that's the problem.