/**
   * Sets initial answer (i.e. button that will be preselected by default).
   *
   * <p>Please note that this is not the default answer that will be returned by {@link
   * #getReturnCode()} if user does nothing (i.e. closes the window). It is just the preselectated
   * button.
   *
   * @param initialAnswer {@link #A_OK}, {@link #A_CANCEL}.
   */
  public void setInitialAnswer(final int initialAnswer) {
    // If the inial answer did not actual changed, do nothing
    if (this._initialAnswer == initialAnswer) {
      return;
    }

    //
    // Configure buttons accelerator (KeyStroke) and RootPane's default button
    final JRootPane rootPane = getRootPane();
    final CButton okButton = confirmPanel.getOKButton();
    final AppsAction okAction = (AppsAction) okButton.getAction();
    final CButton cancelButton = confirmPanel.getCancelButton();
    final AppsAction cancelAction = (AppsAction) cancelButton.getAction();
    if (initialAnswer == A_OK) {
      okAction.setDefaultAccelerator();
      cancelAction.setDefaultAccelerator();
      rootPane.setDefaultButton(okButton);
    } else if (initialAnswer == A_CANCEL) {
      // NOTE: we need to set the OK's Accelerator keystroke to null because in most of the cases it
      // is "Enter"
      // and we want to prevent user for hiting ENTER by mistake
      okAction.setAccelerator(null);
      cancelAction.setDefaultAccelerator();
      rootPane.setDefaultButton(cancelButton);
    } else {
      throw new IllegalArgumentException("Unknown inital answer: " + initialAnswer);
    }

    //
    // Finally, set the new inial answer
    this._initialAnswer = initialAnswer;
  }