The code
Robot r=new Robot();
r.keyPress(KeyEvent.VK_CAPS_LOCK);
r.keyPress(KeyEvent.VK_V);
r.keyPress(KeyEvent.VK_CAPS_LOCK);
does not close after printing the V
. How do I fix this?
The code
Robot r=new Robot();
r.keyPress(KeyEvent.VK_CAPS_LOCK);
r.keyPress(KeyEvent.VK_V);
r.keyPress(KeyEvent.VK_CAPS_LOCK);
does not close after printing the V
. How do I fix this?
You have to release the keys after pressing them:
Robot r=new Robot();
r.keyPress(KeyEvent.VK_CAPS_LOCK);
r.keyRelease(KeyEvent.VK_CAPS_LOCK);
r.keyPress(KeyEvent.VK_V);
r.keyRelease(KeyEvent.VK_V);
r.keyPress(KeyEvent.VK_CAPS_LOCK);
r.keyRelease(KeyEvent.VK_CAPS_LOCK);