Methods Summary |
---|
public void | addElement(java.lang.Object anObject)
objects.addElement(anObject);
fireIntervalAdded(this,objects.size()-1, objects.size()-1);
if ( objects.size() == 1 && selectedObject == null && anObject != null ) {
setSelectedItem( anObject );
}
|
public java.lang.Object | getElementAt(int index)
if ( index >= 0 && index < objects.size() )
return objects.elementAt(index);
else
return null;
|
public int | getIndexOf(java.lang.Object anObject)Returns the index-position of the specified object in the list.
return objects.indexOf(anObject);
|
public java.lang.Object | getSelectedItem()
return selectedObject;
|
public int | getSize()
return objects.size();
|
public void | insertElementAt(java.lang.Object anObject, int index)
objects.insertElementAt(anObject,index);
fireIntervalAdded(this, index, index);
|
public void | removeAllElements()Empties the list.
if ( objects.size() > 0 ) {
int firstIndex = 0;
int lastIndex = objects.size() - 1;
objects.removeAllElements();
selectedObject = null;
fireIntervalRemoved(this, firstIndex, lastIndex);
} else {
selectedObject = null;
}
|
public void | removeElement(java.lang.Object anObject)
int index = objects.indexOf(anObject);
if ( index != -1 ) {
removeElementAt(index);
}
|
public void | removeElementAt(int index)
if ( getElementAt( index ) == selectedObject ) {
if ( index == 0 ) {
setSelectedItem( getSize() == 1 ? null : getElementAt( index + 1 ) );
}
else {
setSelectedItem( getElementAt( index - 1 ) );
}
}
objects.removeElementAt(index);
fireIntervalRemoved(this, index, index);
|
public void | setSelectedItem(java.lang.Object anObject)Set the value of the selected item. The selected item may be null.
if ((selectedObject != null && !selectedObject.equals( anObject )) ||
selectedObject == null && anObject != null) {
selectedObject = anObject;
fireContentsChanged(this, -1, -1);
}
|