com.github.mauromidolo.mousemover.controll.MouseMoverController Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of MouseMover Show documentation
Show all versions of MouseMover Show documentation
Mouse Mover is a tool that moves the mouse automatically every few seconds
The newest version!
package com.github.mauromidolo.mousemover.controll;
/**
* MouseMoverController: controller to manager MouseMoverManager background job
*/
public class MouseMoverController {
private static MouseMoverController mouseMoverController;
private MouseMoverManager thread;
/**
* Singleton instance
*
* @return MouseMoverController instance
*/
public static MouseMoverController getInstance() {
if (mouseMoverController == null) {
mouseMoverController = new MouseMoverController();
}
return mouseMoverController;
}
private MouseMoverController() {
}
/**
* start the background job, if the job is already in exertion stop and restart
*
* @param value seconds to move mouse
*/
public void switchOn(int value) {
if (thread != null) {
thread.stop();
}
thread = new MouseMoverManager(value);
thread.start();
}
/**
* stop the background job
*
*/
public void switchOff() {
if (thread != null) {
thread.stop();
}
thread = null;
}
}