Using Java, is it possible to detect user actions, such as key-presses, mouse-button-presses, and/or mouse's screen location, without the use of GUI elements?
If it is, how could I implement it?
Otherwise, what are the alternatives?
The only StackOverflow source i found on this matter is this question, which is unanswered.
And the only sources I found outside StackOverflow on this matter point to an "Invisible GUI" solution, wish is something i really want to avoid.
It can be implemented using JNI and/or JNA but this cannot be really called "java implementation" because you will have to write platform specific native code.
Alternative solution I tried is to use full screen transparent widow that is listening to all events of mouse and keyboard and "forwards" them to the real application using class Robot
. I tried this approach. It works well with one limitation: there is a problem to support "mouse over" events of applications: the mouse is not moving over the real application. It is moving over the transparent java window.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With