Is it possible to bind an action listener for keyboard events? E.g., I would like to write a program which computes something in the background, and when a key is pressed on the keyboard, the program executes a callback (a block of code).
Needless to say that the program is a command line program without any fancy GUI. Any short snippet will be great :)
System.in& do whatever is appropriate on receiving new data. "Is it possible to bind an action listener for keyboard events?" not in a command-line based app. ..and what millennium is this? Add a GUI.System.inand do whatever you want to do read character/string