char c = event.getActionCommand().charAt(0); if (Character.isISOControl(c)) return;  JTextComponent t = getTextComponent(event); if (t != null && t.isEnabled() && t.isEditable()) t.replaceSelection(event.getActionCommand());
JTextComponent target = getTextComponent(event); if ((target != null) && (event != null)) { if ((target.isEditable()) && (target.isEnabled())) { String content = event.getActionCommand(); int mod = event.getModifiers(); if ((content != null) && (content.length() > 0) && (mod & ActionEvent.ALT_MASK) == 0 && (mod & ActionEvent.CTRL_MASK) == 0) { char c = content.charAt(0); if ((c >= 0x20) && (c != 0x7F)) { target.replaceSelection(content); } } } }
      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 && t.isEnabled() && t.isEditable())        t.replaceSelection(event.getActionCommand());              }