Advertise Here

Author Topic: Move Mouse  (Read 2742 times)

0 Members and 1 Guest are viewing this topic.

Offline |-|Java()|-|

  • SMF For Free Newbie
  • *
  • Posts: 12
    • View Profile

  • Total Badges: 11
    Badges: (View All)
    Topic Starter Combination Level 2 Level 1 10 Posts
Move Mouse
« 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.

Code: [Select]
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();
}

}

 
« Last Edit: September 01, 2008, 10:54:10 am by simply sibyl »
I am a moparScape expert so if you need anyhelp!
Pm me here or on moparscape and I'll help!!
If you need more help add me on my msn moparsc4p3@hotmail.com

Thanks!

 

Related Topics

  Subject / Started by Replies Last post
6 Replies
1722 Views
Last post August 29, 2006, 04:43:53 pm
by Crasy
15 Replies
2592 Views
Last post February 27, 2008, 11:49:14 am
by simply sibyl
9 Replies
2020 Views
Last post March 26, 2008, 04:01:05 pm
by simply sibyl
4 Replies
1481 Views
Last post June 16, 2008, 08:23:19 pm
by Shimmy Shabby
6 Replies
1335 Views
Last post May 18, 2009, 12:52:14 pm
by real digisat