This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes how to get key events after loosing the focus ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "how to get key events after loosing the focus ?" Watch "how to get key events after loosing the focus ?" New topic
Author

how to get key events after loosing the focus ?

naved momin
Ranch Hand

Joined: Jul 03, 2011
Posts: 688

how an app can get key events even though when it doesn't have focus in java ?


The Only way to learn is ...........do!
Visit my blog http://inaved-momin.blogspot.com/
Martin Vajsar
Sheriff

Joined: Aug 22, 2010
Posts: 3606
    
  60

As far as I know, such functionality is not provided by Java. It is usually provided somehow at the OS level, so it is inevitably OS specific. In Windows, you can register either a keyboard hook (to get all keystrokes), or a shortcut key (to get one specific keystroke). The former needs a callback routine placed in a DLL, the latter needs a window handle to send messages to, so you'd need some JNI/JNA wizardry to make it work. And this is only Windows, in other OSes, you'd need to implement another handling.
 
jQuery in Action, 2nd edition
 
subject: how to get key events after loosing the focus ?
 
Similar Threads
Problems in Focus
Can't Focus On JPanel
AWT objectives for the exam
get event from operating system
low level , high level events ?