我試圖編寫程序,它將鼠標移動到某個座標(x,y)。我有這樣的錯誤:機器人不能解析爲類型
Multiple markers at this line - MoveMouse cannot be resolved
我的代碼:
import java.awt.AWTException;
import java.awt.Robot;
public class Temr
{
public static void main(String[] args) throws AWTException
{
MoveMouse tvoi = new MoveMouse(40, 30);
/* Multiple markers at this line
- MoveMouse cannot be resolved
to a type
- MoveMouse cannot be resolved
to a type */
}
public void MoveMouse(int a, int b) throws AWTException
{
Robot robot = new Robot();
int x;
int y;
x = a;
y = b;
robot.mouseMove(x, y);
}
}
謝謝!我也可以讓MoveMouse像班級一樣嗎? – Brade