I'm making a server, and it is on a Text Based Raspberry Pi. basically, everything is running from the command line, so when the server runs, there is no graphics, and it prints everything out using System.out.println();
. so my question is, instead of having a button that runs a shutdown()
method, how can i make it so at any point in time, i am able to push, say, 'e', and the program will run the shutdown()
method? i've done some searching, and am not sure quite how to phrase the question. i was thinking adding a keylistener
, but im not sure if that can be added to nothing graphic? anyway, any help would be appreciated!!! thanks in advance
Alright, so based on the comments, (which i up voted btw), i made a thread that constantly used scanner
to see if i typed "exit". Thanks for all the help!