if (event.getSource() != null && event.getSource() instanceof JTextComponent)
if (event.getSource() instanceof JTextComponent)
  protected final JTextComponent getTextComponent(ActionEvent event)  {    if (event.getSource() != null &&        event.getSource() instanceof JTextComponent)      return (JTextComponent) event.getSource();    else      return getFocusedComponent();  }