/**
   * Returns the initial index into the buttons to select. The index is calculated from the initial
   * value from the JOptionPane and options of the JOptionPane or 0.
   */
  protected int getInitialValueIndex() {
    if (optionPane != null) {
      Object iv = optionPane.getInitialValue();
      Object[] options = optionPane.getOptions();

      if (options == null) {
        return 0;
      } else if (iv != null) {
        for (int counter = options.length - 1; counter >= 0; counter--) {
          if (options[counter].equals(iv)) return counter;
        }
      }
    }
    return -1;
  }