Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to get key events after loosing the focus ?

 
naved momin
Ranch Hand
Posts: 692
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how an app can get key events even though when it doesn't have focus in java ?
 
Martin Vajsar
Sheriff
Pie
Posts: 3751
62
Chrome Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic