Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

OnKeyPress event -- How to do?

807603Nov 13 2007 — edited Nov 13 2007
Hello, I'm trying to figure out how to make a function that knows when a certain key has been pressed (F5, perhaps) and if it has, does something.

I've pretty much found out how to do this from a GUI, but seeing as it's console based I don't know. From what I read you need to set the component to have Focus.

I don't want that, I want this to, when ever it's running, do something everytime I hit a specific key whether the window is opened or closed.

Thanks for the help that anyone can give me :D

edit: I'd just like to note this isn't for malicious use. I don't even think it's possible to write key loggers in Java.

Edited by: Maver on Nov 13, 2007 10:52 AM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 11 2007
Added on Nov 13 2007
0 comments
177 views