Answer the question
In order to leave comments, you need to log in
Why don't '[', ']' and some other keys work when awt.Robot simulates keystrokes on Windows XP, and how to deal with it?
There is a localized version of Windows XP. The robot refuses to press the [ ] keys; ' , / , throwing exceptions instead.
Physically, the keys are available, they are pressed. The layout is en_US. On later versions of Windows and Linux everything works correctly.
Code for testing:
Robot robot = new Robot();
for (int i = 0; i < 256; i++) {
try {
robot.keyPress(i);
robot.delay(100);
robot.keyRelease(i);
} catch (IllegalArgumentException e) {
System.out.println("Failed to press " + KeyEvent.getKeyText(i));
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question