Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java System-Wide Keyboard Shortcut

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

like image 218
fabiopedrosa Avatar asked Jan 19 '09 19:01

fabiopedrosa


People also ask

What is the shortcut key for Expand?

Where you see braces or regions in code, you can collapse or expand them with the keyboard shortcut Ctrl + M, P to expand or Ctrl + M, O to collapse.

What is Ctrl R shortcut?

Alternatively referred to as Control+R, ^r, and C-r, Ctrl+R is a keyboard shortcut most often used to refresh the page in an Internet browser.


2 Answers

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

like image 88
Melloware Avatar answered Oct 11 '22 14:10

Melloware


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?

like image 38
OscarRyz Avatar answered Oct 11 '22 12:10

OscarRyz