Hello guys, I need help with the Robot class in Java. I am trying to excute a couple of keystrokes using an array so it will be less repetitive typing in the keyPress method. Here is the code:
import java.awt.AWTException;
import java.awt.Robot;
import java.awt.event.KeyEvent;
import java.io.IOException;
public class RobotExp {
public static void main(String[] args)throws IOException {
try {
char a[] = {'H', 'E', 'L', 'L', 'O'};
Robot robot = new Robot();
robot.delay(5000);
for(int i = 0; i < a.length; i++)
{
robot.keyPress(KeyEvent.VK_a[i]);
}
robot.mouseMove(100,-10);
} catch (AWTException e) {
e.printStackTrace();
}
}
}
the problem is I get his error when compiling the code:
RobotExp.java:19: error: cannot find symbol
robot.keyPress(KeyEvent.VK_a[i]);