private void setTextAndMnemonicAndListeners(JRadioButton button, @NlsContexts.RadioButton String text, String mnemonic) {
    button.setText(text);
    button.setMnemonic(mnemonic.charAt(0));
    button.setDisplayedMnemonicIndex(button.getText().indexOf(mnemonic));

    // enabled OK button when user selects an option
    Runnable setDefaultButton = () -> {
      JRootPane rootPane = button.getRootPane();
      if (rootPane != null) rootPane.setDefaultButton(getButton(getOKAction()));
    };
    button.addActionListener(e -> setDefaultButton.run());
    button.addItemListener(e -> setDefaultButton.run());
  }
private void setTextAndMnemonicAndListeners(JRadioButton button, @NlsContexts.RadioButton String text, String mnemonic)