Recursive Data StructuresTopKeyboard input - the end

Keyboard input - the end

The program KeyDemo demonstrates how to pick up keypresses in a program. [Nothing will show up in this demo on the web because all of the output is through System.out.println.] The KeyListener interface includes three methods, keyPressed, keyTyped, and keyReleased, so all three must be included in any program implementing KeyListener, even if only one of them is needed. The others may be given an empty body.

If you run this program someplace where the output is visible, you will notice some funny behavior. Basically you should only depend on the method keyPressed for extracting info on which key was pressed.


Recursive Data StructuresTopKeyboard input - the end