• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

capturing all keystroke??

 
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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,
 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic