There seems to be an issue simulating the backspace key with java.awt.Robot.
This thread seems to confirm this but it does not propose a solution.
This works:
Robot rob = new Robot();
rob.keyPress(KeyEvent.VK_A);
rob.keyRelease(KeyEvent.VK_A);
This doesn’t:
Robot rob = new Robot();
rob.keyPress(KeyEvent.VK_BACK_SPACE);
rob.keyRelease(KeyEvent.VK_BACK_SPACE);
Any ideas?
It seems to work in this test.
Addendum: Regarding the cited article, “Aside from those keys that are defined by the Java language (
VK_ENTER,VK_BACK_SPACE, andVK_TAB), do not rely on the values of theVK_ constants. Sun reserves the right to change these values as needed to accomodate a wider range of keyboards in the future.”—java.awt.event.KeyEvent