Java机器人鼠标移动脚本未关闭

Java机器人鼠标移动脚本未关闭,java,Java,我抓取并修改了下面的一些代码,让鼠标每分钟移动一次。使用eclipse运行此代码如果我输入say timeTest(10)并告诉脚本在3分钟后停止运行,它将在10分钟后停止。好像有什么东西还开着 public void timeTest(int i) throws AWTException { Robot hal = new Robot(); Random random = new Random(); int count=0; while(count <

我抓取并修改了下面的一些代码,让鼠标每分钟移动一次。使用eclipse运行此代码如果我输入say timeTest(10)并告诉脚本在3分钟后停止运行,它将在10分钟后停止。好像有什么东西还开着

public void timeTest(int i) throws AWTException {
    Robot hal = new Robot();
    Random random = new Random();

    int count=0;

    while(count < i){
        hal.delay(60000);//wait 1 minute

        int x = random.nextInt() % 640;
        int y = random.nextInt() % 480;

        hal.mouseMove(x,y);

        count++;
    }
}
public void timeTest(inti)抛出AWTException{
Robot hal=新机器人();
随机=新随机();
整数计数=0;
而(计数
您的
delay()
方法中发生了什么?在您的示例中,
i
的值是多少?您如何告诉程序停止?我假设机器人有自己的线程。如果做得不好,这会使程序停止变得复杂。MarsAtomic我把它弄乱了,使它等于一分钟,我想我可以把它改为60000。int I是我希望脚本持续移动鼠标的分钟数。我正在使用的eclipse客户机Tim Hunter正在包装自动化测试工具Rational Functional tester