java - Robot and keyPress -
what sort of code need passed javafx robot when using keypress
method?
for example, example below enters 1
, not a
, suppose there mapping somewhere.
robot robot = com.sun.glass.ui.application.getapplication().createrobot(); robot.keypress(((int) 'a');
note: javafx robot, not awt one.
codes defined constants in javafx.scene.input.keycode.
with glass robot, can use deprecated method impl_getcode
:
robot robot = com.sun.glass.ui.application.getapplication().createrobot(); robot.keypress(keycode.a.impl_getcode());
you can use fxrobot, takes keycodes parameters:
fxrobot robot = fxrobotfactory.createrobot(scene); robot.keypress(javafx.scene.input.keycode.a);
Comments
Post a Comment