private void setOptions(String[] options, int selectedOption)
   throws IllegalArgumentException {
      if ((selectedOption < 0) || (selectedOption > options.length - 1)) {
         throw new IllegalArgumentException("invalid selection");
      }
      if ((options == null) || (options.length == 0)) {
         throw new IllegalArgumentException("options is null or empty");
      }
      for (int i = 0; i < options.length; i++) {
         if ((options[i] == null) || (options[i].length() == 0)) {
            throw new IllegalArgumentException("options[" + i + "] is null or empty");
         }
      }
      this.options = options;
      this.selection = selectedOption;
   }