Skip to main content

Mouse pointer mover program in java

Purpose of this article:

  1. Stop auto locking monitor screen.
  2. Increase time spent duration at office in analytics tools like Sapience.

Note-

Sapience analytics is a tool that capture activity data from your computer like how many hours you logged-in, opens application name etc.

For more details about sapience analytics tool please refer given below URL:

https://sapienceanalytics.com/


Example

MousePointerMover.java

package in.techmentor;

import java.awt.Robot;
import java.util.Random;

/**
 * The Class MousePointerMover.
 */
public class MousePointerMover {

	/** The Constant TEN_SECONDS. */
	public static final int TEN_SECONDS = 10000;

	/** The Constant X_AXIS. */
	public static final int X_AXIS = 500;

	/** The Constant Y_AXIS. */
	public static final int Y_AXIS = 500;

	public static void main(String[] args) throws Exception {
		Robot robot = new Robot();
		Random random = new Random();
		while (true) {
			robot.mouseMove(random.nextInt(X_AXIS), random.nextInt(Y_AXIS));
			Thread.sleep(TEN_SECONDS);
		}
	}
}

Download source code

Download it from Github- mouse-pointer-mover

Leave a Reply

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

Top