문제

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