I'm writing a program where I need to capture mouse and keyboard events, but I don't want these events to be associated with my program. For example, when a user clicks the mouse button, out of my program, I want to be able to recognize that there has been a mouse pressed event. The only type of mouse listeners I can use at the moment is addMouseListener to a component, but this is useless as my program will be running in the back ground and therefore the components will not be in focus. It needs to be something like a system listener that captures events system wide.
Can anyone point me in the right direction please. Thankyou for any help
This is a very platform-specific thing not at all suited to Java. Even in Windows, this is not trivial with the API (and I don't think it is too easy in Linux, Unix or Mac, either). In any case, you will need to write a JNI module for each platform you want to handle.