Java Robot 类的作用是什么?
Java中的Robot类到底有什么功能?是按键还是什么?
What function exactly does the Robot class in Java serve? Does it press keys or what?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
Java中的Robot类到底有什么功能?是按键还是什么?
What function exactly does the Robot class in Java serve? Does it press keys or what?
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(2)
机器人类按下按键并使用鼠标。
使用该类,您可以执行五个操作:按下键、释放键、移动鼠标、按下鼠标按钮和释放鼠标按钮。它还可以获取特定屏幕坐标处的像素颜色,或在 BufferedImage 中生成屏幕截图。
这些方法不仅仅在 Java 中伪造这一点,它们还直接访问低级窗口系统输入事件。通过使用这些方法,您可以编写一些与应用程序交互的程序以进行测试或自动化。完整的 API 位于此处。
The robot class presses keys and uses the mouse.
Using this class, you can do five actions: press key, release key, move mouse, press mouse button, and release mouse button. It can also get the pixel color at a specific screen coordinate, or generate a screenshot in a
BufferedImage
.These methods do not just fake this within Java, they access low-level windowing system input events directly. By using these methods, you can program something that will interact with an application for testing or automation. The full API is here.
它按下按键并移动鼠标。它基本上假装是一个用户。
It presses keys and moves the mouse. It basically fakes being a user.