• Post Reply Bookmark Topic Watch Topic
  • New Topic

capturing all keystroke??  RSS feed

 
Jigar Gosar
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is there a way to capture all keystrokes, in an java app, even though the app is not under keyboard focus???

actually i want to write an java application which runs in background and should pop on screen when i press a key combo such as alt-shift-p so something like that, can it be done with java.

also i m planning to write a java app, that would launch my fav apps at press of a keystroke, even if that app dosenot have keyboard focus.

i m not in position to write native code in c/c++,
and it would be ok if the solution is windows specific.

please help
 
Lionel Badiou
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jigar,

Your project sounds too close to the OS for Java developpement. Howewer, you may consider using Windows' system tray to activate your background application with a click. To achieve that, I suggest you to check theses packages :

- http://jeans.studentenweb.org/java/trayicon/trayicon.html
- http://systray.sourceforge.net/
- http://www.javaapis.com/jtray/

Best regards,
 
David Mace
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah, unfortunately Lionel is right on this one. It's not possible to trap the keystrokes unless a container of some sort has focus. I know that you said you can't do native C/C++, but that would be a solution to your problem... i.e. writing some native code to trap the keystrokes and calling this native code through JNI.

David
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!