The VK_
values are static fields in the KeyEvent
class.
Here is a list of all the values.
Question
I want to have a method that would click a certain key
public void pressKey ( KeyEvent keyName ) { // what class must keyName belong to ?
this.robot.keyPress(KeyEvent.keyName);
this.robot.keyRelease(KeyEvent.keyName);
Thread.sleep(100);
}
It should work as a shorcut for example
pressKey(VK_ENTER);
But I tried to look up those VK_
codes and still do not know to what class do the keycodes belong ?
Solution
The VK_
values are static fields in the KeyEvent
class.
Here is a list of all the values.
OTHER TIPS
The VK_
codes are of type int
.