*
The moose likes Beginning Java and the fly likes Press any key to continue... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Press any key to continue..." Watch "Press any key to continue..." New topic
Author

Press any key to continue...

Brian Legg
Ranch Hand

Joined: Nov 07, 2008
Posts: 488
How would you put in the functionality to pause the program until the user presses any key, then the program will continue on?

I know there are some easy ways to do this in C but I haven't seen any in Java. Do you have to write some native code in order to do this?

Any help is appreciated. (and please no Scanner.nextLine() stuff. I don't want the user to have to press enter, I want them to press any key to continue.)

Thanks!!


SCJA
~Currently preparing for SCJP6
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19759
    
  20

I'd say that reading from System.in is all you need, but it blocks until the user presses enter. Quite a shame.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Brian Legg
Ranch Hand

Joined: Nov 07, 2008
Posts: 488
Yes quite!! I only want to block until the user presses any key.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Press any key to continue...