A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
The Software Craftsman
this week in the
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?
Submitting a form on pressing Enter key
Regarding Action and KeyEvents
when press key enter then an action is performed ..
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015