The applet below prints information about keystrokes as Swing sees them. [source code]
SwingKeys requires Java 1.4+ and Swing. See JavaKeys for an AWT version that works with Java 1.1+. SwingKeys with JPanel event source is similar to this applet, but gets key events from a JPanel instead of a JTextField.
Swing components may produce different sequences of events depending on whether there are any input method event (IME) listeners present. You may see different events with different settings of the IME checkbox, particularly if you type characters that use dead keys or otherwise involve an input method. Since the simplest and most common use of Swing text components is to let Swing handle the input method, the IME checkbox is off by default. IME behavior is not completely symmetrical; turning the IME checkbox on then off again may not give the same event sequence as when it has never been turned on (this is due to JTextComponent behavior, not a bug in SwingKeys).
SwingKeys version 1, Copyright (C) 2006 Doyle B. Myers. SwingKeys comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under the terms of the GNU General Public License.