if (list.size() == 0) { list.add(object); selectedItem = object; fireContentsChanged(this, -1, -1); } else { list.add(object); fireIntervalAdded(this, list.size() - 1, list.size() - 1); }
list.add(object); fireIntervalAdded(this, list.size() - 1, list.size() - 1); if (list.size() == 1) setSelectedItem(object);
  public void addElement(Object object)  {    if (list.size() == 0)      {        list.add(object);        selectedItem = object;        fireContentsChanged(this, -1, -1);      }    else      {        list.add(object);        fireIntervalAdded(this, list.size() - 1, list.size() - 1);      }  }