获取鼠标位置 [英] Get Mouse Position
本文介绍了获取鼠标位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想用 Java 模拟鼠标的自然移动(从这里到那里一个像素一个像素地移动).为此,我需要知道起始坐标.
I would like to simulate a natural mouse movement in Java (going from here to there pixel by pixel). To do that I need to know the starting coordinates.
我找到了 event.getX() 和 event.getY() 方法,但我需要一个事件...
I've found the method event.getX() and event.getY() but I need an event...
如何在不做任何事情(或不可见的事情)的情况下知道位置?
How can I know the positions without doing anything (or something not visible)?
谢谢
推荐答案
MouseInfo.getPointerInfo().getLocation() 可能会有所帮助.它返回一个与当前鼠标对应的 Point 对象位置.
MouseInfo.getPointerInfo().getLocation() might be helpful. It returns a Point object corresponding to current mouse position.
这篇关于获取鼠标位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文