Advertisement
Guest User

MouseCursor

a guest
Mar 9th, 2013
684
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.92 KB | None | 0 0
  1. /* TO USE THIS: COPY THIS ENTIRE CODE
  2.         SAVE IT SOMEWHERE AS MouseCursor.java
  3.         Navigate to it using command line (i.e. "cd C:\...")
  4.         Execute "javac MouseCursor" (this compiles the file)
  5.         Execute "java MouseCursor" (this runs the file)
  6.  
  7.     Have fun dicking around at work!
  8.  
  9. */
  10.  
  11. import java.awt.AWTException;
  12. import java.awt.MouseInfo;
  13. import java.awt.Robot;
  14.  
  15. public class MouseCursor {
  16.  
  17.     public static void main(String[] args) {
  18.         System.out.println("Starting up...");
  19.         while (true) {
  20.             try {
  21.                 System.out.println(System.currentTimeMillis());
  22.                 int x = MouseInfo.getPointerInfo().getLocation().x;
  23.                 int y = MouseInfo.getPointerInfo().getLocation().y;
  24.                 Robot r = new Robot();
  25.                 r.mouseMove(x+1,y+1);
  26.                 r.mouseMove(x,y);
  27.                 Thread.sleep(60*1000);
  28.             }
  29.             catch (AWTException ex) {
  30.                 ex.printStackTrace();
  31.             }
  32.             catch (InterruptedException ex) {
  33.                 ex.printStackTrace();
  34.             }
  35.         }
  36.     }
  37.  
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement