File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Utilities Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Utilities" Watch "Utilities" New topic


Ryan Foster

Joined: Sep 23, 2003
Posts: 6
Is there a Utility.pressEnterKey (), if there is how do you use it? I can not figure out how to code it?
Thank Ryan
Marilyn de Queiroz

Joined: Jul 22, 2000
Posts: 9059
Utility.pressEnterKey (), Not that I am aware of. What are you trying to do? Do you want to check whether the user is pressing the enter key in order to end user input or to insert a character or some other reason?

"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Ryan Foster

Joined: Sep 23, 2003
Posts: 6
I would like to have the user to press the Enter key to continue with possible input, ect.
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
What is the user interacting with ... the console? If you are writing to stdout and reading from stdin, the user must press Enter to complete the readln() and get any data into your program. If you do:

your code will block (wait) for the user to hit enter.
If you're not talking about the console, this means nothing, and I'll invite you to try the question again. Hope that helped!

A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Jim Yingst

Joined: Jan 30, 2000
Posts: 18671
Or if you want to pop up a GUI dialog that waits until the user presses the OK button (or hits return, since that button is the default):

The JOptionPane class has many variations of this type of dialog, so if something like this is suitable for you application, check out the documentation for the other showXXXDialog() methods.
[ October 27, 2003: Message edited by: Jim Yingst ]

"I'm not back." - Bill Harding, Twister
Ryan Foster

Joined: Sep 23, 2003
Posts: 6
Thank you for all your responses. They did help and point me in the right direction.
I agree. Here's the link:
subject: Utilities
It's not a secret anymore!