Java KeyPress arrow keys triggers numpad keys

时光毁灭记忆、已成空白 提交于 2020-01-03 18:48:09

问题


When using Robot.keyPress for the KeyEvent VK_UP, the numpad key is triggered rather than the normal arrow key. I am trying to write a keyboard emulator that can be used for games etc. Testing with TrackMania I notice that it does not trigger the normal key, but the key on the numpad.

How can I trigger the normal keys using keyPress?

Checking the API, it is supposed to be the non-numpad arrow key. Which it isnt.

Robot r = new Robot();
r.keyPress(KeyEvent.VK_UP);

This will generate the numpad up key.

If this cannot be done in Java, is there any language that allows it?

来源:https://stackoverflow.com/questions/12565510/java-keypress-arrow-keys-triggers-numpad-keys

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!