Robot#keyPress
expects an int
, which represents the virtual key code as described in java.awt.KeyEvent
Specifically, key 0
represents KeyEvent.VK_UNDEFINED
which is an "invalid key code"
Don't forget that until you call keyRelease
, the keys will continue to be pressed, generating repeated key pressed events...