if (numOfItems + 1 == items.length) { ImageStringItem newitems[] = new ImageStringItem[numOfItems + 4]; boolean newselectedItems[] = new boolean[numOfItems + 4]; System.arraycopy(items, 0, newitems, 0, elementNum); System.arraycopy(items, elementNum, newitems, elementNum + 1, numOfItems - elementNum); System.arraycopy(selectedItems, 0, newselectedItems, 0, elementNum); System.arraycopy(selectedItems, elementNum, newselectedItems, elementNum + 1, numOfItems - elementNum); items = newitems; selectedItems = newselectedItems;
if (numOfItems == items.length  ) { ChoiceItem newItems[] = new ChoiceItem[numOfItems + 4]; System.arraycopy(items, 0, newItems, 0, numOfItems); items = newItems;
  public void insert(int elementNum, String stringPart, Image imagePart)  {		if (elementNum < 0 || elementNum > numOfItems) {			throw new IndexOutOfBoundsException();		}		if (imagePart != null && imagePart.isMutable()) {			throw new IllegalArgumentException();		}		if (stringPart == null) {			throw new NullPointerException();		}    if (numOfItems + 1 == items.length) {      ImageStringItem newitems[] = new ImageStringItem[numOfItems + 4];			boolean newselectedItems[] = new boolean[numOfItems + 4];      System.arraycopy(items, 0, newitems, 0, elementNum);      System.arraycopy(items, elementNum, newitems, elementNum + 1, numOfItems - elementNum);      System.arraycopy(selectedItems, 0, newselectedItems, 0, elementNum);      System.arraycopy(selectedItems, elementNum, newselectedItems, elementNum + 1, numOfItems - elementNum);      items = newitems;			selectedItems = newselectedItems;    }		if (choiceType == Choice.EXCLUSIVE) {	    items[elementNum] = new ImageStringItem(null, imgRadioOff, stringPart);		} else if (choiceType == Choice.MULTIPLE) {	    items[elementNum] = new ImageStringItem(null, imgMultiOff, stringPart);		} else if (choiceType == Choice.IMPLICIT) {	    items[elementNum] = new ImageStringItem(null, null, stringPart);		}		selectedItems[elementNum] = false;    numOfItems++;  }