Dear All,
I had google for example how to use java.awt.Robot class. I also read Java Document regarding of awt.Robot class. When I test below code, I get error message "cannot find symbol method delay(int)" and "cannot find symbol method keyPress (int)". May I know what is my problem?
*Installed JDK Version 6 update 21
I had google for example how to use java.awt.Robot class. I also read Java Document regarding of awt.Robot class. When I test below code, I get error message "cannot find symbol method delay(int)" and "cannot find symbol method keyPress (int)". May I know what is my problem?
*Installed JDK Version 6 update 21
Code:
import java.awt.AWTException;
import java.awt.Robot;
import java.awt.event.KeyEvent;
public class MyRobot
{
public static void main (String [] args)
{
try {
MyRobot myrobot = new MyRobot();
myrobot.delay(3000);
myrobot.keyPress(KeyEvent.VK_T);
myrobot.keyPress(KeyEvent.VK_E);
myrobot.keyPress(KeyEvent.VK_S);
myrobot.keyPress(KeyEvent.VK_K);
} catch (AWTException e) {
e.printStackTrace();
}
}
}
Comment