开发者

Record Keystrokes outside of the application

Recently I made an autoclicker for a game, which would allow you to use F1 and F2 to turn it on or off, once I finished the application I thought to myself, "oh great, I forgot Java doesn't let you record outside keystrok开发者_如何学Goes and mouse movements", is there any simple non-native ways to do this?

Thanks.


Nope. You can do application wide keyboard and mouse handling, but you have very few options if your application is not the foreground application. The best you can do is discover the mouse location:

java.awt.MouseInfo.getPointerInfo().getLocation()

This will always work. You are out of luck for keyboard input though. For that you will need to write native code.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜