Detect if any mouse button is being pressed, and if so, which one?
问题 Basically, I want to query if any mouse button is being pressed and if so, which one. The problem is that I don't use a (constantly focused) UI environment. It is meant to be able to run in the background while the OS is focused on another window. I just have a Swing GUI set up for easy controlling. How could I do this? (By the way, I am trying to query it inside of a loop, so setting up an event listener wouldn't be efficient.) 回答1: As mentioned by others you would need to use JNA in order