Hello everybody,
I understand the basics of Java, but not such features as are helpful in an applet namely Listeners.
I wanted to create a feature like this:
A program would be displayed in the regular old System.out.
It would be looping continuously doing something unimportant, say counting how many times it could count to a billion, until the user enters a command, and then it would simply delay what it was doing, display something unimportant ("hello") and then go back to what it was doing.
At current I only know how to make the program Stop and Wait for the user to enter something, and then do it again.
I know that a key listener or something similar is what I'm after, but I don't know how to use them or if I need one, because I only want input from System.in (which I would usually use a Scanner to get).
Could someone point me to a proper tutorial, or perhaps crack out an example for me?
All in all I'm looking for:
Something that will listen for the user to hit the Enter key, then read in whatever they typed before it in the command line, rather than some newly created and displayed text box.
Thanks everyone for your time.
I understand the basics of Java, but not such features as are helpful in an applet namely Listeners.
I wanted to create a feature like this:
A program would be displayed in the regular old System.out.
It would be looping continuously doing something unimportant, say counting how many times it could count to a billion, until the user enters a command, and then it would simply delay what it was doing, display something unimportant ("hello") and then go back to what it was doing.
At current I only know how to make the program Stop and Wait for the user to enter something, and then do it again.
I know that a key listener or something similar is what I'm after, but I don't know how to use them or if I need one, because I only want input from System.in (which I would usually use a Scanner to get).
Could someone point me to a proper tutorial, or perhaps crack out an example for me?
All in all I'm looking for:
Something that will listen for the user to hit the Enter key, then read in whatever they typed before it in the command line, rather than some newly created and displayed text box.
Thanks everyone for your time.
Comment