• Post Reply Bookmark Topic Watch Topic
  • New Topic

Background Process to play sound when keystroke is hit?  RSS feed

 
SpuTTer fCo
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, I would like to have my application do something when someone presses the "T" key. This in itself, isnt hard. However, I would like it to happen even if my program doesnt have focus. I want it to play a .wav file when I hit the T key. Any ideas? I cant seem to find a way to get the keypress if Im not focused on my application.
Im using awt/swing, but anything that works is fine.
One of my friends is saying that he can do it in visual C++ with no problems. I told him that it should be no problem in java, but Im finding out that it might be...
I have one written that displays it fine if it has focus, but how do I get it to work if that application is not active?
 
Chantal Ackermann
Ranch Hand
Posts: 508
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think you can do it with a java application that is not active. Java's secure policy does not admit it, I hope.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!