void (ActionEvent e) { AWTEvent event = EventQueue.getCurrentEvent(); if (event instanceof KeyEvent && event.getSource() == myComponent) { Container parent = myComponent.getParent(); if (parent != null) { KeyEvent keyEvent = (KeyEvent)event; parent.dispatchEvent(new KeyEvent(parent, event.getID(), ((KeyEvent)event).getWhen(), keyEvent.getModifiers(), keyEvent.getKeyCode(), keyEvent.getKeyChar(), keyEvent .getKeyLocation())); } } }