This commit is contained in:
parent
9ad074bb51
commit
c3c1b99f1b
@ -9,8 +9,6 @@ import wtf.beatrice.autosqueal.ui.MainWindow;
|
|||||||
|
|
||||||
public class Main {
|
public class Main {
|
||||||
|
|
||||||
private static boolean running = true;
|
|
||||||
|
|
||||||
private static final Logger LOGGER = LogManager.getLogger(Main.class);
|
private static final Logger LOGGER = LogManager.getLogger(Main.class);
|
||||||
private static final MainWindow mainWindow = new MainWindow();
|
private static final MainWindow mainWindow = new MainWindow();
|
||||||
|
|
||||||
|
@ -14,14 +14,14 @@ public class CursorMover extends TimerTask
|
|||||||
{
|
{
|
||||||
|
|
||||||
private static final Logger LOGGER = LogManager.getLogger(CursorMover.class);
|
private static final Logger LOGGER = LogManager.getLogger(CursorMover.class);
|
||||||
private final Random RANDOM;
|
private final Random random;
|
||||||
|
|
||||||
private static final int LOOPS_BEFORE_CLICK = 5;
|
private static final int LOOPS_BEFORE_CLICK = 5;
|
||||||
|
|
||||||
private int iteration = 0;
|
private int iteration = 0;
|
||||||
|
|
||||||
public CursorMover() {
|
public CursorMover() {
|
||||||
RANDOM = new SecureRandom();
|
random = new SecureRandom();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -45,8 +45,8 @@ public class CursorMover extends TimerTask
|
|||||||
|
|
||||||
iteration = 0;
|
iteration = 0;
|
||||||
} else {
|
} else {
|
||||||
destX = RANDOM.nextInt(RunnerUtil.SCREEN_WIDTH);
|
destX = random.nextInt(RunnerUtil.SCREEN_WIDTH);
|
||||||
destY = RANDOM.nextInt(RunnerUtil.SCREEN_HEIGHT);
|
destY = random.nextInt(RunnerUtil.SCREEN_HEIGHT);
|
||||||
|
|
||||||
singleStepMovementTask = new SingleStepMovementTask(destX, destY, false);
|
singleStepMovementTask = new SingleStepMovementTask(destX, destY, false);
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ public class SingleStepMovementTask extends TimerTask {
|
|||||||
try {
|
try {
|
||||||
robot = new Robot();
|
robot = new Robot();
|
||||||
} catch (AWTException e) {
|
} catch (AWTException e) {
|
||||||
throw new RuntimeException(e);
|
LOGGER.error(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -11,9 +11,6 @@ public class CursorMoveListener extends TimerTask {
|
|||||||
private int oldX;
|
private int oldX;
|
||||||
private int oldY;
|
private int oldY;
|
||||||
|
|
||||||
private int newX;
|
|
||||||
private int newY;
|
|
||||||
|
|
||||||
private int loops;
|
private int loops;
|
||||||
private boolean isUserAway;
|
private boolean isUserAway;
|
||||||
|
|
||||||
@ -28,8 +25,8 @@ public class CursorMoveListener extends TimerTask {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
newX = MouseInfo.getPointerInfo().getLocation().x;
|
int newX = MouseInfo.getPointerInfo().getLocation().x;
|
||||||
newY = MouseInfo.getPointerInfo().getLocation().y;
|
int newY = MouseInfo.getPointerInfo().getLocation().y;
|
||||||
|
|
||||||
if(newX != oldX || newY != oldY) {
|
if(newX != oldX || newY != oldY) {
|
||||||
// cursor has been moved
|
// cursor has been moved
|
||||||
|
@ -23,11 +23,6 @@ public class MainWindow
|
|||||||
private CursorMover cursorMover = new CursorMover();
|
private CursorMover cursorMover = new CursorMover();
|
||||||
private Button toggleButton;
|
private Button toggleButton;
|
||||||
|
|
||||||
|
|
||||||
public MainWindow() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void init() {
|
public void init() {
|
||||||
|
|
||||||
JFrame frame = new JFrame();
|
JFrame frame = new JFrame();
|
||||||
|
Loading…
Reference in New Issue
Block a user