What sort of code need to be passed to the JavaFX Robot when using the keyPress
method?
For example, the example below enters a 1
, not an <
Codes are defined as constants in javafx.scene.input.KeyCode.
With the glass robot, you can use the deprecated method impl_getCode
:
Robot robot = com.sun.glass.ui.Application.GetApplication().createRobot();
robot.keyPress(KeyCode.A.impl_getCode());
You can also use the FXRobot, which takes KeyCodes as parameters:
FXRobot robot = FXRobotFactory.createRobot(scene);
robot.keyPress(javafx.scene.input.KeyCode.A);