• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Press any key to continue...

 
Brian Legg
Ranch Hand
Posts: 488
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!!
 
Rob Spoor
Sheriff
Pie
Posts: 20369
44
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd say that reading from System.in is all you need, but it blocks until the user presses enter. Quite a shame.
 
Brian Legg
Ranch Hand
Posts: 488
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes quite!! I only want to block until the user presses any key.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic