Created
January 30, 2024 17:09
-
-
Save OrangoMango/d5b8371bba291cf67613f49a43b7c8ae to your computer and use it in GitHub Desktop.
Simple autoclicker made in Java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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