I have been using the java.awt.Robot
class (especially pressKey() method) in my code.
However, once my code terminates, my keys get reconfigured. In my case, I had robot press Ctrl and R. Afterwards, my key functions for Start and Escape switched roles. And that was just one of several switches.
What is the fix to this?
Any help would be appreciated. Thank you.
This is because this function only press the key and not release it. You must call robot.keyRelease(); once after calling keypress() or call it for all the keys when closing the application.