I want to perform a specific action anytime a certain key combination is pressed while the program is running even if the window is not in focus. For instance, if I press CTRL-U the program would exit. Is this possible?
-
This is not supported by Java. Java can only respond to KeyEvents when a window is in focus. You need to use JNI (which I know nothing about) or another language that does allow access to the OS.camickr– camickr2010-09-19 21:37:56 +00:00Commented Sep 19, 2010 at 21:37
-
Possible duplicates: stackoverflow.com/questions/901224/…, stackoverflow.com/questions/800747/…Ash– Ash2010-09-20 05:54:30 +00:00Commented Sep 20, 2010 at 5:54
-
@camickr, JNA might be easier to deal with, most of the Windows APIs already have C interfaces...Mark Elliot– Mark Elliot2010-09-30 01:51:40 +00:00Commented Sep 30, 2010 at 1:51
Add a comment
|