Java browsing by tag


The Mouse Move Program

Sunday, May 29th, 2016

I once wrote a piece of code to prove that you didn’t actually have to be at your computer for your IM to state that you are active. This has since gone on to be a frequently talked about piece of code. Here it is 🙂

import java.awt.*;
import java.util.*;

public class MouseMove {
  public static void main(String[] args) throws Exception{
    Robot mm = new Robot();
    Random random = new Random();
    while(true) {
      int x = java.lang.Math.abs(random.nextInt() % 640);
      int y = java.lang.Math.abs(random.nextInt() % 480);