Bug. Keylistener should be keyPressed, not keyTyped.