SMF For Free Support Forum
General Stuff => Programming => Java => Topic started by: |-|Java()|-| on July 18, 2007, 10:34:23 pm
-
Well it's sloppy and not that great but I'm not good at java programming well here it is you can modify it to your needs IDK.
import java.applet.*;
import java.awt.AWTException;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Robot;
import java.util.Random;
public class Main extends Applet implements Runnable {
public void wait(int time){
try {
Thread.sleep(time);
} catch (InterruptedException e) {
}
}
public void moveMouse(int x,int y) {
Robot rob=null;
try {
rob = new Robot();
} catch (AWTException e) {
}
rob.mouseMove(x,y);
}
public int random(int ran) {
Random Ran = new Random();
return 0+Ran.nextInt(ran);
}
public boolean more(int a, int b ) {
boolean ret = false;
if (a > b) {
ret = false;
}else {
ret = true;
}
return ret;
}
public void move(int x){
int yspeed=0,ypos=50;
int a=10,b=x;
moveMouse(10,50);
wait(100);
for (int i = 10; i < b- 4; i++){
for (int c = -1; c < random(3); c++){
yspeed = c;
} if (i < b / a * 9) {
switch (yspeed) {
case -1 : yspeed= +1;break;
case +1 : yspeed= -1;break;
default : yspeed= 0; break;
}
if (more ( ypos, i)==true) {
for (int w = 2; w < 2; w--){
yspeed = w;
} if ( ypos > i) {
yspeed = +1;
}
}
}
ypos += yspeed;
moveMouse(i,ypos);
wait(random(20));
}
moveMouse(x,50);
}
public void init() {
move(200);
}
public void run(){
}
public void start(){
Thread th = new Thread (this);
th.start();
}
}