This commit is contained in:
parent
d841288db7
commit
46265e99b1
@ -8,8 +8,12 @@ import java.util.TimerTask;
|
||||
|
||||
public class CursorMoveListener extends TimerTask {
|
||||
|
||||
private int oldX, oldY;
|
||||
private int newX, newY;
|
||||
private int oldX;
|
||||
private int oldY;
|
||||
|
||||
private int newX;
|
||||
private int newY;
|
||||
|
||||
private int loops;
|
||||
private boolean isUserAway;
|
||||
|
||||
|
@ -10,11 +10,15 @@ public class CursorMover extends TimerTask {
|
||||
|
||||
private static final Logger LOGGER = LogManager.getLogger(CursorMover.class);
|
||||
|
||||
final int destX, destY;
|
||||
final int destX;
|
||||
final int destY;
|
||||
final Robot robot;
|
||||
|
||||
float currentX, currentY;
|
||||
float stepX = 1, stepY = 1;
|
||||
float currentX;
|
||||
float currentY;
|
||||
|
||||
float stepX = 1;
|
||||
float stepY = 1;
|
||||
boolean isRunning = true;
|
||||
|
||||
|
||||
@ -26,7 +30,8 @@ public class CursorMover extends TimerTask {
|
||||
destX = destinationX;
|
||||
destY = destinationY;
|
||||
|
||||
int lengthX, lengthY;
|
||||
int lengthX;
|
||||
int lengthY;
|
||||
|
||||
lengthX = Math.round(Math.abs(currentX - destX));
|
||||
lengthY = Math.round(Math.abs(currentY - destY));
|
||||
|
@ -13,8 +13,9 @@ import java.util.List;
|
||||
public class KeyPressListener implements NativeKeyListener
|
||||
{
|
||||
private static final Logger LOGGER = LogManager.getLogger(KeyPressListener.class);
|
||||
private final static List<Integer> pressedKeysIds = new ArrayList<>();
|
||||
private static final List<Integer> pressedKeysIds = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public void nativeKeyPressed(NativeKeyEvent e) {
|
||||
LOGGER.info("Key Pressed: {}", NativeKeyEvent.getKeyText(e.getKeyCode()));
|
||||
|
||||
@ -31,6 +32,7 @@ public class KeyPressListener implements NativeKeyListener
|
||||
handlePressedKeys();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void nativeKeyReleased(NativeKeyEvent e) {
|
||||
LOGGER.info("Key Released: {}", NativeKeyEvent.getKeyText(e.getKeyCode()));
|
||||
|
||||
@ -44,9 +46,7 @@ public class KeyPressListener implements NativeKeyListener
|
||||
pressedKeysIds.contains(NativeKeyEvent.VC_CONTROL)) {
|
||||
|
||||
StringBuilder keys = new StringBuilder();
|
||||
pressedKeysIds.forEach(keyCode -> {
|
||||
keys.append("[").append(NativeKeyEvent.getKeyText(keyCode)).append("]");
|
||||
});
|
||||
pressedKeysIds.forEach(keyCode -> keys.append("[").append(NativeKeyEvent.getKeyText(keyCode)).append("]"));
|
||||
|
||||
LOGGER.warn("Received shutdown keystroke: {}", keys);
|
||||
|
||||
|
@ -41,7 +41,8 @@ public class Main {
|
||||
|
||||
LOGGER.info("Starting coordinates: {}, {}", currentX, currentY);
|
||||
|
||||
int randomX, randomY;
|
||||
int randomX;
|
||||
int randomY;
|
||||
|
||||
randomX = random.nextInt(width);
|
||||
randomY = random.nextInt(height);
|
||||
@ -90,6 +91,6 @@ public class Main {
|
||||
|
||||
timer.cancel();
|
||||
|
||||
Thread.sleep(TIME_BETWEEN_MOVES * 1000);
|
||||
Thread.sleep(TIME_BETWEEN_MOVES * 1000L);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user