Skip to content

Instantly share code, notes, and snippets.

@OrangoMango
Created January 30, 2024 17:09
Show Gist options
  • Save OrangoMango/d5b8371bba291cf67613f49a43b7c8ae to your computer and use it in GitHub Desktop.
Save OrangoMango/d5b8371bba291cf67613f49a43b7c8ae to your computer and use it in GitHub Desktop.
Simple autoclicker made in Java
import javafx.application.Application;
import javafx.application.Platform;
import javafx.stage.Stage;
import javafx.scene.robot.Robot;
import javafx.animation.AnimationTimer;
import javafx.scene.input.MouseButton;
public class AutoClicker extends Application {
@Override
public void start(Stage stage) {
Robot robot = new Robot();
AnimationTimer timer = new AnimationTimer() {
@Override
public void handle(long time) {
robot.mouseClick(MouseButton.PRIMARY);
}
};
timer.start();
new Thread(() - > {
try {
Thread.sleep(6000);
timer.stop();
} catch (InterruptedException ex) {
ex.printStackTrace();
}
}).start();
}
public static void main(String[] args) {
launch(args);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment