Java Keystroke and Mouse Event Tutor / Keyboard diagnostic. Application
to let you experiment to learn how mouse and keystroke events work.
Output appears on the console. Just click the mouse or hit keystrokes and
watch what details of the events generated. You can use it to learn how
Java events work, how the keyboard hardware works, and to diagnose
defective keyboards.
To install, Extract the zip download with WinZip, available from
http://www.winzip.com (or similar unzip utility) into any directory you
please, often C:\ -- ticking off the "user folder names" option. To run
as an application, type:
java.exe -jar C:\com\mindprod\keyplayer\keyplayer.jar
adjusting as necessary to account for where the jar file is.
Whenever you hit a key on the keyboard, three events will show up at your
KeyListener, first an event at keyPressed, then at keyTyped, then at
keyReleased. If you hold a key down and it repeats, you will see that
triple repeated over and over. If you hit the ctrl key and hold it down
you will see repeated events at keyPressed and finally one at keyReleased
when you let go. There is no event at keyTyped. When you hit Ctrl+C you
see keyCode 03, ^C, ETX not the letter C. Java combines the keys for you.
It is not your problem to track the ctrl or shift state and modify the
meanings of other keystrokes.
If certain keystrokes are missing, try rebooting with as many autorun
programs as possible disabled, One of them may be capturing the keystroke
combination, e.g. Winamp or Allchars.
Your keyboard may be malfunctioning. Powering off and on may clear it.
Don't connect/disconnect the keyboard with the power on. It if is
progammable, reset it. If some keys stick or malfunction, try cleaning
your keyboard. See http://mindprod.com/bgloss/keyboardcleaning.html
See http://mindprod.com/jgloss/event11.html#KEYSTROKEEVENTS
and http://mindprod.com/jgloss/event11.html#KEYSTROKENAMES
for more detail on interpreting the output.
Nothing will happen unless the KeyPlayer window (not the console window)
has focus and the console window is not paused. Click with your mouse in
the empty KeyPlayer window if you see not response in the console window.
I like to run KeyPlayer in a Take Command console window where I can
easily control the width, height, colours etc. of the window. See
http://mindprod.com/jgloss/takecommand.html
Testing
Run Keyplayer.
Click the Keyplayer window (not the console). You should see one line for
each mouse or keystroke event packet generated.
mouseEntered ID=504=MOUSE_ENTERED (166,189)
mousePressed ID=501=MOUSE_PRESSED (151,155) BUTTON1_MASK
mouseReleased ID=502=MOUSE_RELEASED(151,155) BUTTON1_MASK
mouseClicked ID=500=MOUSE_CLICKED (151,155) BUTTON1_MASK
mouseExited ID=505=MOUSE_EXITED (151,197)
Hit the A key. You should see:
keyPressed ID=401=KEY_PRESSED raw KeyCode='A'=0x0041=65 VK_A cooked KeyChar='a'=0x0061=97
keyTyped ID=400=KEY_TYPED raw KeyCode='_'=0x0000=0 VK_UNDEFINED cooked KeyChar='a'=0x0061=97
keyReleased ID=402=KEY_RELEASED raw KeyCode='A'=0x0041=65 VK_A cooked KeyChar='a'=0x0061=97
hit the space key. You should see:
keyPressed ID=401=KEY_PRESSED raw KeyCode=' '=0x0020=32 VK_SPACE cooked KeyChar=' '=0x0020=32
keyTyped ID=400=KEY_TYPED raw KeyCode='_'=0x0000=0 VK_UNDEFINED cooked KeyChar=' '=0x0020=32
keyReleased ID=402=KEY_RELEASED raw KeyCode=' '=0x0020=32 VK_SPACE cooked KeyChar=' '=0x0020=32
tap the alt key. You should see:
keyPressed ID=401=KEY_PRESSED raw KeyCode='_'=0x0012=18 VK_ALT cooked KeyChar='_'=0xffff=65535 ALT_MASK
keyReleased ID=402=KEY_RELEASED raw KeyCode='_'=0x0012=18 VK_ALT cooked KeyChar='_'=0xffff=65535
hit the F2 funciton key. You should see:
keyPressed ID=401=KEY_PRESSED raw KeyCode='q'=0x0071=113 VK_F2 cooked KeyChar='_'=0xffff=65535
keyReleased ID=402=KEY_RELEASED raw KeyCode='q'=0x0071=113 VK_F2 cooked KeyChar='_'=0xffff=65535