,
in a future release it will be a real Collection implementation.
| Method from javax.swing.DefaultListModel Detail: |
public void add(int index,
Object element) {
delegate.insertElementAt(element, index);
fireIntervalAdded(this, index, index);
}
Inserts the specified element at the specified position in this list.
Throws an ArrayIndexOutOfBoundsException if the
index is out of range
(index < 0 || index > size()). |
public void addElement(Object obj) {
int index = delegate.size();
delegate.addElement(obj);
fireIntervalAdded(this, index, index);
}
Adds the specified component to the end of this list. |
public int capacity() {
return delegate.capacity();
}
Returns the current capacity of this list. |
public void clear() {
int index1 = delegate.size()-1;
delegate.removeAllElements();
if (index1 >= 0) {
fireIntervalRemoved(this, 0, index1);
}
}
Removes all of the elements from this list. The list will
be empty after this call returns (unless it throws an exception). |
public boolean contains(Object elem) {
return delegate.contains(elem);
}
Tests whether the specified object is a component in this list. |
public void copyInto(Object[] anArray) {
delegate.copyInto(anArray);
}
Copies the components of this list into the specified array.
The array must be big enough to hold all the objects in this list,
else an IndexOutOfBoundsException is thrown. |
public Object elementAt(int index) {
return delegate.elementAt(index);
}
Returns the component at the specified index.
Throws an ArrayIndexOutOfBoundsException if the index
is negative or not less than the size of the list.
Note: Although this method is not deprecated, the preferred
method to use is get(int), which implements the
List interface defined in the 1.2 Collections framework.
|
public Enumeration elements() {
return delegate.elements();
}
Returns an enumeration of the components of this list. |
public void ensureCapacity(int minCapacity) {
delegate.ensureCapacity(minCapacity);
}
Increases the capacity of this list, if necessary, to ensure
that it can hold at least the number of components specified by
the minimum capacity argument. |
public Object firstElement() {
return delegate.firstElement();
}
Returns the first component of this list.
Throws a NoSuchElementException if this
vector has no components. |
public Object get(int index) {
return delegate.elementAt(index);
}
Returns the element at the specified position in this list.
Throws an ArrayIndexOutOfBoundsException
if the index is out of range
(index < 0 || index >= size()). |
public Object getElementAt(int index) {
return delegate.elementAt(index);
}
Returns the component at the specified index.
Note: Although this method is not deprecated, the preferred
method to use is get(int), which implements the
List interface defined in the 1.2 Collections framework.
|
public int getSize() {
return delegate.size();
}
Returns the number of components in this list.
This method is identical to size, which implements the
List interface defined in the 1.2 Collections framework.
This method exists in conjunction with setSize so that
size is identifiable as a JavaBean property. |
public int indexOf(Object elem) {
return delegate.indexOf(elem);
}
Searches for the first occurrence of elem. |
public int indexOf(Object elem,
int index) {
return delegate.indexOf(elem, index);
}
Searches for the first occurrence of elem, beginning
the search at index. |
public void insertElementAt(Object obj,
int index) {
delegate.insertElementAt(obj, index);
fireIntervalAdded(this, index, index);
}
|
public boolean isEmpty() {
return delegate.isEmpty();
}
Tests whether this list has any components. |
public Object lastElement() {
return delegate.lastElement();
}
Returns the last component of the list.
Throws a NoSuchElementException if this vector
has no components. |
public int lastIndexOf(Object elem) {
return delegate.lastIndexOf(elem);
}
Returns the index of the last occurrence of elem. |
public int lastIndexOf(Object elem,
int index) {
return delegate.lastIndexOf(elem, index);
}
Searches backwards for elem, starting from the
specified index, and returns an index to it. |
public Object remove(int index) {
Object rv = delegate.elementAt(index);
delegate.removeElementAt(index);
fireIntervalRemoved(this, index, index);
return rv;
}
Removes the element at the specified position in this list.
Returns the element that was removed from the list.
Throws an ArrayIndexOutOfBoundsException
if the index is out of range
(index < 0 || index >= size()). |
public void removeAllElements() {
int index1 = delegate.size()-1;
delegate.removeAllElements();
if (index1 >= 0) {
fireIntervalRemoved(this, 0, index1);
}
}
Removes all components from this list and sets its size to zero.
Note: Although this method is not deprecated, the preferred
method to use is clear, which implements the
List interface defined in the 1.2 Collections framework.
|
public boolean removeElement(Object obj) {
int index = indexOf(obj);
boolean rv = delegate.removeElement(obj);
if (index >= 0) {
fireIntervalRemoved(this, index, index);
}
return rv;
}
Removes the first (lowest-indexed) occurrence of the argument
from this list. |
public void removeElementAt(int index) {
delegate.removeElementAt(index);
fireIntervalRemoved(this, index, index);
}
|
public void removeRange(int fromIndex,
int toIndex) {
if (fromIndex > toIndex) {
throw new IllegalArgumentException("fromIndex must be < = toIndex");
}
for(int i = toIndex; i >= fromIndex; i--) {
delegate.removeElementAt(i);
}
fireIntervalRemoved(this, fromIndex, toIndex);
}
Deletes the components at the specified range of indexes.
The removal is inclusive, so specifying a range of (1,5)
removes the component at index 1 and the component at index 5,
as well as all components in between.
Throws an ArrayIndexOutOfBoundsException
if the index was invalid.
Throws an IllegalArgumentException if
fromIndex > toIndex. |
public Object set(int index,
Object element) {
Object rv = delegate.elementAt(index);
delegate.setElementAt(element, index);
fireContentsChanged(this, index, index);
return rv;
}
Replaces the element at the specified position in this list with the
specified element.
Throws an ArrayIndexOutOfBoundsException
if the index is out of range
(index < 0 || index >= size()). |
public void setElementAt(Object obj,
int index) {
delegate.setElementAt(obj, index);
fireContentsChanged(this, index, index);
}
|
public void setSize(int newSize) {
int oldSize = delegate.size();
delegate.setSize(newSize);
if (oldSize > newSize) {
fireIntervalRemoved(this, newSize, oldSize-1);
}
else if (oldSize < newSize) {
fireIntervalAdded(this, oldSize, newSize-1);
}
}
Sets the size of this list. |
public int size() {
return delegate.size();
}
Returns the number of components in this list. |
public Object[] toArray() {
Object[] rv = new Object[delegate.size()];
delegate.copyInto(rv);
return rv;
}
Returns an array containing all of the elements in this list in the
correct order. |
public String toString() {
return delegate.toString();
}
Returns a string that displays and identifies this
object's properties. |
public void trimToSize() {
delegate.trimToSize();
}
Trims the capacity of this list to be the list's current size. |