Java Keyboard/Mouse activity (even outside of my app)
问题 I need to detect when the mouse or keyboard activity is present. My application runs in the background (tray) and I need to detect this activity even when my app isn't in focus. I don't need to know what keys were pressed, but simply WHEN they are pressed. Can I do this with just Java? I have read some solutions using JNI and C++/C but they seem to be OS specific. Is there an easy solution to this that will work with Windows, Linux, and Mac? Thanks! 回答1: Since JNI is required, which relys on