用Java实现可重复性的鼠标键盘事件--Robot类的使用
Robot类的定义:
构建
Robot() // 在初始屏幕的坐标系上构建一个Robot类
Constructs a Robot object in the coordinate system of the primary screen.
Robot(GraphicsDevice screen) // 在特定屏幕上创建
Creates a Robot for the given screen device.
方法总结
返回值和返回类型
方法
描述
BufferedImage
createScreenCapture(Rectangle screenRect)
创建包含从屏幕读取的像素的图像。
void
delay(int ms)
特定时间段休眠时间
int
getAutoDelay()
返回执行某一事件后Robot的休眠时间
Color
getPixelColor(int x, int y)
返回当前坐标值的像素颜色
boolean
isAutoWaitForIdle()
返回此机器人在生成事件后是否自动调用waitForIdle
void
keyPress(int keycode)
模拟按下键盘按键
void
keyRelease(int keycode)
模拟释放键盘按键
void
mousePress(int buttons)
模拟按下鼠标按钮
void
mouseRelease(in