//create the event handler for key preview functionality
keyEventListener = new AWTEventListener() {
public void eventDispatched(AWTEvent aWTEvent) {
if (aWTEvent instanceof KeyEvent) {
KeyEvent evt = (KeyEvent)aWTEvent;
for (KeyListener kl : getKeyListeners()) {
int id = aWTEvent.getID();
switch (id) {
case KeyEvent.KEY_PRESSED:
kl.keyPressed(evt);