Issue
So, whenever I run the program below it says "InputEvent cannot be resolved to a variable". Can you help me to fix this problem? Heres's the code ->
import java.awt.AWTException;
import java.awt.Robot;
public class RobotExp4{
public static void main(String [] args){
try{
Robot robot = new Robot();
System.out.println("3 Seconds after this message appears the robot will click");
robot.delay(3000);
robot.mousePress(InputEvent.BUTTON1_MASK);
robot.delay(75);
robot.mouseRelease(InputEvent.BUTTON1_MASK);
} catch (AWTException e) {
e.printStackTrace();
}
}
}
Solution
You miss the import statement for that class.
Simply add import java.awt.event.InputEvent;
at the top of your source code.
Answered By - edean