How to send CTRL + Z keyEvent in java using Robot class

I use the Robot class to send keys. I tried the robot.keyPress() function. But I could not figure out how to send CTRL + z keyEvent.

+8
java
source share
1 answer
 robot.keyPress(KeyEvent.VK_CONTROL) robot.keyPress(KeyEvent.VK_Z) // CTRL+Z is now pressed (receiving application should see a "key down" event.) robot.keyRelease(KeyEvent.VK_Z) robot.keyRelease(KeyEvent.VK_CONTROL) // CTRL+Z is now released (receiving application should now see a "key up" event - as well as a "key pressed" event). 
+11
source share

All Articles