Can you help me refactor this code:
public static void pressRightShift() {
robot.keyPress(KeyEvent.VK_SHIFT);
}
Please mention how to press for right\left shift keys as well.Thanks!
I found a Java tutorial that includes a Java WebStart sample and the source code. Looks like the winner is KeyEvent.getKeyLocation()
KeyEvent.KEY_LOCATION_STANDARD
KeyEvent.KEY_LOCATION_LEFT
KeyEvent.KEY_LOCATION_RIGHT
KeyEvent.KEY_LOCATION_NUMPAD
KeyEvent.KEY_LOCATION_UNKNOWN
References:
Key Listener Demo and Source Code
Hope this helps!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.