File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
EJB 3 in Action
this week in the
EJB and other Java EE Technologies
How to detect ENTER key from console app?
Joined: Nov 12, 2001
Oct 11, 2002 06:43:00
I want the user who can press the ENTER key and then go to the next function. e.g. Press ENTER key to calculate the number of year.
How can I use it with System.in?
Thanks for help
Joined: Dec 03, 2001
Oct 11, 2002 07:29:00
With System.in, enter is the only key press you can detect as soon as it happens. If you call readLine() it will return as soon as the user hits enter. The user may have typed other things as well, but you can ignore them.
I agree. Here's the link:
subject: How to detect ENTER key from console app?
Regarding Action and KeyEvents
when press key enter then an action is performed ..
Submitting a form on pressing Enter key
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014