Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Listen to mouse clicks on whole system (not on a JFrame etc.)

I want to write a little code which react to a mouse click. But it seems the only way is to listen to clicks on Java components. A direct listener to all clicks would be great.

Is there actually a possibility to implement this in Java?

Thanks in advance!

Update:

Found out, that it would need a hook via JNI with some C coding.

More information on http://www.jotschi.de/?p=90

Best regards, fnst

like image 988
fnst Avatar asked Oct 25 '22 22:10

fnst


1 Answers

It's perfectly possible if you are willing to use a third party library - JNativeHook

It provides these functionality using JNI which is otherwise not possible in pure java apps.

like image 136
Extreme Coders Avatar answered Oct 31 '22 08:10

Extreme Coders