質問

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 ?

役に立ちましたか?

解決

The VK_ values are static fields in the KeyEvent class.

Here is a list of all the values.

他のヒント

The VK_ codes are of type int.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top