SRL Archive - General

Basic java mouse movements


rj

2013-04-21 17:20:23

Can someone link me to some sort of guide/code for basic java mousemovents? So far I have:

public void MMouse(int sx, int sy, int ex, int ey, int speed) throws AWTException {
Robot robot = new Robot();
int a = 10;
boolean flag = true;
for (int i = 0; i < 100; i++) {
int mov_x = ((ex * i) / 100) + (sx * (100 - i) / 100);
int mov_y = ((ey * i) / 100) + (sy * (100 - i) / 100);
if (flag == true) {
robot.mouseMove(mov_x + a, mov_y); // adds 10 to X-axis
flag = false;
} else {
robot.mouseMove(mov_x - 2 * a, mov_y); // subtracts 20 to X-axis
flag = true;
}
robot.delay(speed);
}
}

Le Jingle

2013-04-21 17:50:25

I think SMART has an example, credit to BenLand100
https://github.com/BenLand100/SMART/blob/master/src/EventNazi.java#L200

rj

2013-04-21 17:59:45

From: Le Jingle
I think SMART has an example, credit to BenLand100
https://github.com/BenLand100/SMART/blob/master/src/EventNazi.java#L200


OOO ty