keyboard hit

Been all over deja and the question is always left hanging.

I've tried various io classes to try and recognize a keyboard press
inside a java console program.  All seem to need the flush of
a 'ENTER' key.

Is there a way to recognize a keyboard hit?

Thanks.

while (!class.ready()) doesn't work
LVL 1
hank1Asked:
Who is Participating?
 
CEHJCommented:
No - not without native code
0
 
InteractiveMindCommented:
As CEHJ has said, not without Native code.. if you can do some C/C++, then you can see here for how to create a Keyboard Hook: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/hooks/hookreference/hookfunctions/lowlevelkeyboardproc.asp
You'd then need to use JNI to implement this into your Java app; but I'll let CEHJ explain how to do that ;) hehehe (don't ask me!).
0
 
CEHJCommented:
:-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.