Thursday, October 21, 2010

java program to move mouse

A sample application which makes your mouse to move automatically randomly on screen with high speed.

Robot Mouse code:

//Program starts here 
import java.awt.Robot;
public class MouseControl
{
public static void main(String[] hj)
{
   try
    {
       //to move mouse with more speed use this for loop
        for(int i=0;i<10000;i++){
        Robot ro=new Robot();
        ro.mouseMove((int)(Math.random()*1024),(int)(Math.random()*786));
     }
 catch(Exception e)
 {
   System.out.println(e);
  }
}
}

execute it...and find .... plz don`t misuse this program


Explanation:
Robot is a class in java, which is used to control mouse and keyboard.with help of methods.
To control here I used movemouse(), and Math.random() to move mouse randomly on the screen.



Tags --------> Access specifiers         How to import Packages                 Applets

No comments:

Post a Comment