Beispiel #1
0
  /**
   * Adds the specified item to the specified location in the list. If the desired index is -1 or
   * greater than the number of rows in the list, then the item is added to the end.
   *
   * @param item The item to add to the list.
   * @param index The location in the list to add the item, or -1 to add to the end.
   */
  public void add(String item, int index) {
    if ((index == -1) || (index >= items.size())) items.addElement(item);
    else items.insertElementAt(item, index);

    if (peer != null) {
      ListPeer l = (ListPeer) peer;
      l.add(item, index);
    }
  }