I am using JavaFX
to recieve Key input using .setOnKeyReleased
. The problem is that this gives me a keyCode
, but to use the robot class
(tried fx robot but it is "restricted") I need a keyValue int
.
Is there anyway i can convert a KeyCode
or (Fx)KeyEvent
into a keyValue
? Please help, can not figure this out. Thanks
You could try
impl_getCode()
of the KeyCode. But be aware, that this is internal and most probably will change with Java 9. From the KeyCode class:Why this method isn't a proper one, is a mystery.
Use it e. g. like this:
If everything fails with the Java implementation changes, you could always just create your own mapping of JavaFX key codes to awt key codes using the Java source.