This bug is known for years, yet is is still present in Java 1.7.0_25
version which I'm using on Windows 8. The following result are same regardless of wether i have numlock turned on or not:
Robot bot = new Robot();
bot.keyPress(KeyEvent.VK_UP); //this in documentation is non-numpad up arrow key
bot.keyRelease(KeyEvent.VK_UP); //pressed the numpad up arrow key
//folowing line is line #43
bot.keyPress(KeyEvent.VK_KP_UP); //this in documentation is numpad up arrow key
bot.keyRelease(KeyEvent.VK_KP_UP); //causes folowing exception:
Exception in thread "main" java.lang.IllegalArgumentException: Invalid key code
at sun.awt.windows.WRobotPeer.keyPress(Native Method)
at java.awt.Robot.keyPress(Robot.java:358)
at test.RobotArrow.main(RobotArrow.java:43)
I know this question was already asked here but over a year ago, so is there any progress? I cant google anything, there is even an ofiicial bug report
So, is there finnaly a solution or not?