Java System-Wide Keyboard Shortcut?

There is not, but in windows you can use this.

There is not, but in windows you can use this: jintellitype Unfortunately there is nothing I'm aware of for Linux and OSX, probably that's why it doesn't come with java out of the box. If you find for the other platforms post it here please :) Just for couriosity, what are you doing with that?

Thanks for your reply. I wanted this feature, so I the user could bring a popup window from anywhere on the system. Its something very usual in windows apps, but I wanted cross-platform support.

– mrlinx Jan 19 '09 at 21:03 Yeah, well, I guess we will have to wait. I've heard this is quite easy to do in Linux and OSX, I don't know why a half way platform 3rd party has been coded already. Sure it won't be supported by Sun.

– OscarRyz Jan 20 '09 at 16:00 1 Jintellitype mentions JxGrabKey (sourceforge.net/projects/jxgrabkey) project which offers the same feature for Linux. – Domchi Dec 5 '09 at 14:41.

UPDATE: I don't know if you can hook events from OUTSIDE the JVM. I think a Swing/AWT component must have focus for this to work. You'll want to hook in the Java AWT Event Queue to be absolutely sure you can get a global (jvm wide) keypress.

Use EventQueue ev = Toolkit. GetSystemEventQueue(); // MyCustomEventQueue extends EventQueue and processes keyboard events in the dispatch ev. Push(new MyCustomEventQueue()); class MyEventQueue extends EventQueue { protected void dispatchEvent(AWTEvent event) { // all AWTEvents can be indentified by type, KeyEvent, MouseEvent, etc // look for KeyEvents and match against you hotkeys / callbacks } } I think there may be other ways to accomplish global key presses with action maps.

I've actually used the above mether.

Basszero: About your update, yes, the java app must have focus for this to work. – OscarRyz Jan 19 '09 at 19:26 I really wanted without needing focus. Thanks anyway.

– mrlinx Jan 19 '09 at 21:02.

For windows you need a keyboard hook dll. You can initialize your dll from java, which will cause it to register the listener. You'll get what you need.

Check msdn for dll hooks, or keyboard hooks. One of those should set you up. For linux I think this should be easier, but I have never done it myself.

ubuntuforums.org/showthread.php?t=864566 Google's first result for "linux listen for global key presses" (no quotes) turns up something which I think will help you out for X11 environments OSX might just be able to use a solution close to this. But in the end, you'll probably need a dll for every platform, unless JNA could do this without issue, then the worst is done.

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 Google Code so if you want an idea of how it works just check out the source code. http://code.google.com/p/jintellitype.

JDIC (Java Desktop Integration) could help https://jdic.dev.java.net/ Seems to be a little unmaintained to me. I'm not sure. If someone know more, please report!

I'm also very interested in this feature.

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.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions