if (t != null) { try { t.getDocument().insertString(t.getCaret().getDot(), event.getActionCommand(), null); } catch (BadLocationException be) {  } }
if (t != null && t.isEnabled() && t.isEditable()) t.replaceSelection(event.getActionCommand());
    public void actionPerformed(ActionEvent event)    {      // first we filter the following events:      // - control characters      // - key events with the ALT modifier (FIXME: filter that too!)      char c = event.getActionCommand().charAt(0);      if (Character.isISOControl(c))        return;      JTextComponent t = getTextComponent(event);      if (t != null)        {          try            {              t.getDocument().insertString(t.getCaret().getDot(),                                           event.getActionCommand(), null);            }          catch (BadLocationException be)            {              // FIXME: we're not authorized to throw this.. swallow it?            }        }    }