private void setChoices(String[] choices) throws IllegalArgumentException {
      if (choices == null || choices.length == 0) {
         throw new IllegalArgumentException("invalid choices");
      }
      for (int i = 0; i < choices.length; i++) {
         if (choices[i] == null || choices[i].length() == 0) {
            throw new IllegalArgumentException("invalid choice at index #"+i);
         }
      }
      this.choices = choices;
   }