Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

keyboard hit

Posted on 2005-04-18
3
Medium Priority
?
399 Views
Last Modified: 2012-05-07
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
0
Comment
Question by:hank1
  • 2
3 Comments
 
LVL 86

Accepted Solution

by:
CEHJ earned 200 total points
ID: 13806339
No - not without native code
0
 
LVL 25

Expert Comment

by:InteractiveMind
ID: 13807139
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
 
LVL 86

Expert Comment

by:CEHJ
ID: 13822360
:-)
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Suggested Courses
Course of the Month13 days, 7 hours left to enroll

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question