当前位置: 动力学知识库 > 问答 > 编程问答 >

windows 8 - Java Robot does not simulate TAB KEY in windows8. Why? and how can i fix it?

问题描述:

I was trying to simulate TAB KEY using class java.awt.Robot; in Windows8 but it does not work(just like no key pressed). I had tried in OS X Yosemite, it worked perfectly.

try {

Robot robot = new Robot();

robot.setAutoDelay(50);

robot.keyPress(KeyEvent.VK_TAB);

robot.keyRelease(KeyEvent.VK_TAB);

}catch (AWTException e){}

Someone can tell me why it does not work? and how can I simulate tab key in Windows8 ?

One more question, what does this method do?

robot.waitForIdle()

分享给朋友:
您可能感兴趣的文章:
随机阅读: