Copyright (c) SEMM NL All rights reserved.
Author : Paul Hamaker. Part of


This class contains these 3 methods,...

so it implements the KeyListener interface...

and, being a KeyListener, an instance of this class can be registered as listener to the JTextField.

Each method receives a KeyEvent parameter, ...

that is shown, as text, in the first JTextArea.

In the keyTyped method we can determine the character typed, uppercase, lowercase letter, exclamation mark etc...

and show it in the bottom JTextArea.

Digits do not appear in the JTextField, because they are filtered out.

The keyTyped method is NOT called for function keys, arrow keys and other such control keys.

That's where keyPressed comes in : here you can determine the key code...

and compare this to constants in the KeyEvent class.

Check if there was a key combination. isShiftDown() is another possibility.




Keycodes are the same for upper and lower case character keys.


BUG before 1.3 : NO CONSUMPTION .