Hello everyone,
I am trying to create a program that clicks a desired amount of clicks after one second intervals. My code doesn't seem to be doing what I want it to do thus far. Here it is:
import java.lang.Object.*;
import java.awt.AWTException;
import java.awt.Robot;
import java.awt.event.InputEvent;
import javax.swing.*;
public class MainClass {
public static int numClicks = 0;
public static int numDesiredClicks = 0;
public static void main(String[] args) throws Exception {
getDesiredClicks();
Robot robot = new Robot();
if(numClicks<numDesiredClicks)
{
robot.mousePress(InputEvent.BUTTON1_MASK);
robot.delay(500);
robot.mouseRelease(InputEvent.BUTTON1_MASK);
robot.delay(1000);
numClicks++;
}
}
public static void getDesiredClicks()
{
numDesiredClicks = Prompter.promptForInteger("How many clicks should be performed?");
}
}