import java.awt.MouseInfo;
import java.awt.Point;
import java.awt.Robot;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
public class ScreenSaverFucker {
public static final long SLEEP = 15000L;
public static final boolean DEBUG = true;
public static int COUNT ;
public static void main(String[] args) throws Exception {
Robot rbt = new Robot();
for(COUNT = 1 ; true ; COUNT++){
Point oldP = MouseInfo.getPointerInfo().getLocation();
int move = 1 - ((COUNT & 1) << 1);
System.out.println("COUNT:"+COUNT);
System.out.println("move"+move);
Point newP = new Point(oldP.x + move, oldP.y + move);
rbt.mouseMove(newP.x, newP.y);
if(DEBUG){
log(oldP, newP);
}
Thread.sleep(SLEEP);
}
}
public static void log(Point oldP, Point newP){
String str = "(" + oldP.x + "," + oldP.y +")" + "\t >" +
"(" + newP.x + "," +newP.y + ")";
DateFormat fmt = new SimpleDateFormat("[HH:mm:ss]");
String date = fmt.format(System.currentTimeMillis());
System.out.println(date + COUNT + "回目:\t" + str);
}
}
java获取鼠标位子和改动鼠标位子
最新推荐文章于 2023-05-05 15:22:13 发布