if (accelerator != null)
  protected void configurePropertiesFromAction(Action action)  {    super.configurePropertiesFromAction(action);    if (! (this instanceof JMenu) && action != null)      {        setAccelerator((KeyStroke) (action.getValue(Action.ACCELERATOR_KEY)));        super.registerKeyboardAction(action, accelerator,                                      JComponent.WHEN_IN_FOCUSED_WINDOW);      }  }