1
如何找到正在改变坐标的颜色的位置,需要在识别后点击。爪哇机器人类的鼠标移动到特定像素的位置(鼠标点击一种颜色)
程序的目的完成游戏中的任务,需要点击不总是在相同位置的不同颜色。
代码当前执行的程序5秒
public class RobotColorClick
{
public RobotColorClick() throws AWTException, IOException, InterruptedException
{
Robot robot = new Robot();
//Delay 5 seconds
robot.delay(5000);
//Gets color (value of red,green,blue) from the mouse position after 5 seconds
Color color = robot.getPixelColor(MouseInfo.getPointerInfo().getLocation().x
, MouseInfo.getPointerInfo().getLocation().y);
//Delay 3 seconds
robot.delay(3000);
//Mouse moves to X and Y then right click
//Problem! How to set X and Y to position color coordinates, position will change
robot.mouseMove(x, y);
robot.mousePress(InputEvent.BUTTON1_MASK);
robot.mouseRelease(InputEvent.BUTTON1_MASK);
}
public static void main(String[] args) throws AWTException, IOException,
InterruptedException
{
new RobotColorClick();
}
}
[高级系统活动](http://sourceforge.net/p/javaxsystem/wiki/Home/#dcf7)可能对您有所帮助。 – Visruth