Categories
java

automatic mouse mover in java

In this post, we will do automatic mouse mover in java

We can move the cursor with random directions using below code

Example
import java.awt.Robot;

public class MouseMover {

	public static void main(String[] args) {
		try {
			int xCord = 10;
			int yCord = 20;
			while (true) {

				Robot robot = new Robot();
				robot.mouseMove(xCord++, yCord++);
				System.out.println("Moving mouse to " + xCord + " " + yCord);
				Thread.sleep(10000);
			}

		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
Github

https://github.com/rkumar9090/student-example/blob/master/src/main/java/com/beginnersbug/example/mouse/MouseMover.java

Leave a Reply

Your email address will not be published. Required fields are marked *