tags:

views:

102

answers:

1

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 keystrokes and mouse movements", is there any simple non-native ways to do this?

Thanks.

+3  A: 

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.

NateS