Beispiel #1
0
  public void addElement(Object element) {
    if (!(element instanceof ChoiceItem))
      throw new IllegalArgumentException(
          "element has to be of type ChoiceItem, but is of type " + element.getClass().getName());

    super.addElement(element);
  }
Beispiel #2
0
  public void insertElementAt(Object o, int index) {
    if (!(o instanceof ChoiceItem))
      throw new IllegalArgumentException(
          "Added objects has to be of type ChoiceItem. Object was of type "
              + o.getClass().getName());

    super.insertElementAt(o, index);
  }