I just looked at the output of my own program a little closer :-) and I
have found the problem you are facing.
A sample output line is:
java.awt.event.KeyEvent[KEY_PRESSED,keyCode=39,keyText=Right,keyChar=Undefined
keyChar,keyLocation=KEY_LOCATION_STANDARD] on
testCaptureKeyEvents.TestWindow$ConsoleTextArea[,0,0,100x100,layout=javax.swing.plaf.basic.BasicTextUI$UpdateHandler,alignmentX=null,alignmentY=null,border=javax.swing.plaf.basic.BasicBorders$MarginBorder@79dce4,flags=296,maximumSize=,minimumSize=,preferredSize=java.awt.Dimension[width=100,height=100],caretColor=javax.swing.plaf.ColorUIResource[r=0,g=0,b=0],disabledTextColor=javax.swing.plaf.ColorUIResource[r=128,g=128,b=128],editable=true,margin=javax.swing.plaf.InsetsUIResource[top=0,left=0,bottom=0,right=0],selectedTextColor=apple.laf.CColorPaintUIResource[r=0,g=0,b=0],selectionColor=apple.laf.CColorPaintUIResource[r=180,g=213,b=213],colums=0,columWidth=0,rows=0,rowHeight=0,word=false,wrap=false]
As you can see, it says "keyChar=Undefined". Since you are testing for
keyChar's in your code switch (event.getKeyChar())
Your case statements will never be valid, since the keyChar is
undefined. So the solution for you is instead of testing for keyChar's,
you will want to test for keyCode's, which are defined (for example,
the right arrow is keyCode 39, left is keyCode 37).
Kind regards, Jonck
>I have written an SSCCE for you, if you run it, typing in the TextArea
>will result in showing you in the console which events were captured
>and its details. As you will see the KEY_PRESSED event is captured.
I have a similar program that gives detail on each key event.
See http://mindprod.com/products1.html#KEYPLAY

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.