Java System-Wide Keyboard Shortcut

后端 未结 7 819
北海茫月
北海茫月 2020-12-01 04:12

Is there any way or a library to get a system-wide (global) keyboard shortcut to perform an action in a Java application?

7条回答
  •  独厮守ぢ
    2020-12-01 04:18

    I am the author of JIntellitype and I can tell you for a fact this must be done natively in DLL and called from Java JNI just like JIntellitype does it. This is an OS level hook that is not implemented in the JDK so libraries like JIntellitype and jxGrabKey must be used. As far as I know no one has written one for OSX yet.

    JIntellitype is open source on Github, so if you want an idea of how it works just check out the source code

提交回复
热议问题