• Post Reply Bookmark Topic Watch Topic
  • New Topic

Keyboard events without GUI

 
vivien siu
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi, is there a way to accept input from user without using any GUI interface? My program will take in the key typed by user then responds according to the key typed. All this will be done in Command Prompt and run from JAR file.
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you looked at the java.util.Scanner class?
 
vivien siu
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yups, using the System.in for the constructor argument. Thanks
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!