< prev index next >
src/java.desktop/share/classes/javax/swing/DefaultListModel.java
Print this page
@@ -30,24 +30,24 @@
import javax.swing.event.*;
/**
- * This class loosely implements the <code>java.util.Vector</code>
+ * This class loosely implements the {@code java.util.Vector}
* API, in that it implements the 1.1.x version of
- * <code>java.util.Vector</code>, has no collection class support,
- * and notifies the <code>ListDataListener</code>s when changes occur.
- * Presently it delegates to a <code>Vector</code>,
+ * {@code java.util.Vector}, has no collection class support,
+ * and notifies the {@code ListDataListener}s when changes occur.
+ * Presently it delegates to a {@code Vector},
* in a future release it will be a real Collection implementation.
* <p>
* <strong>Warning:</strong>
* Serialized objects of this class will not be compatible with
* future Swing releases. The current serialization support is
* appropriate for short term storage or RMI between applications running
* the same version of Swing. As of 1.4, support for long term storage
* of all JavaBeans™
- * has been added to the <code>java.beans</code> package.
+ * has been added to the {@code java.beans} package.
* Please see {@link java.beans.XMLEncoder}.
*
* @param <E> the type of the elements of this model
*
* @author Hans Muller
@@ -59,14 +59,14 @@
private Vector<E> delegate = new Vector<E>();
/**
* Returns the number of components in this list.
* <p>
- * This method is identical to <code>size</code>, which implements the
- * <code>List</code> interface defined in the 1.2 Collections framework.
- * This method exists in conjunction with <code>setSize</code> so that
- * <code>size</code> is identifiable as a JavaBean property.
+ * This method is identical to {@code size}, which implements the
+ * {@code List} interface defined in the 1.2 Collections framework.
+ * This method exists in conjunction with {@code setSize} so that
+ * {@code size} is identifiable as a JavaBean property.
*
* @return the number of components in this list
* @see #size()
*/
public int getSize() {
@@ -75,16 +75,16 @@
/**
* Returns the component at the specified index.
* <blockquote>
* <b>Note:</b> Although this method is not deprecated, the preferred
- * method to use is <code>get(int)</code>, which implements the
- * <code>List</code> interface defined in the 1.2 Collections framework.
+ * method to use is {@code get(int)}, which implements the
+ * {@code List} interface defined in the 1.2 Collections framework.
* </blockquote>
* @param index an index into this list
* @return the component at the specified index
- * @exception ArrayIndexOutOfBoundsException if the <code>index</code>
+ * @exception ArrayIndexOutOfBoundsException if the {@code index}
* is negative or greater than the current size of this
* list
* @see #get(int)
*/
public E getElementAt(int index) {
@@ -92,11 +92,11 @@
}
/**
* 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 <code>IndexOutOfBoundsException</code> is thrown.
+ * else an {@code IndexOutOfBoundsException} is thrown.
*
* @param anArray the array into which the components get copied
* @see Vector#copyInto(Object[])
*/
public void copyInto(Object anArray[]) {
@@ -162,13 +162,13 @@
}
/**
* Tests whether this list has any components.
*
- * @return <code>true</code> if and only if this list has
+ * @return {@code true} if and only if this list has
* no components, that is, its size is zero;
- * <code>false</code> otherwise
+ * {@code false} otherwise
* @see Vector#isEmpty()
*/
public boolean isEmpty() {
return delegate.isEmpty();
}
@@ -185,80 +185,80 @@
/**
* Tests whether the specified object is a component in this list.
*
* @param elem an object
- * @return <code>true</code> if the specified object
+ * @return {@code true} if the specified object
* is the same as a component in this list
* @see Vector#contains(Object)
*/
public boolean contains(Object elem) {
return delegate.contains(elem);
}
/**
- * Searches for the first occurrence of <code>elem</code>.
+ * Searches for the first occurrence of {@code elem}.
*
* @param elem an object
* @return the index of the first occurrence of the argument in this
- * list; returns <code>-1</code> if the object is not found
+ * list; returns {@code -1} if the object is not found
* @see Vector#indexOf(Object)
*/
public int indexOf(Object elem) {
return delegate.indexOf(elem);
}
/**
- * Searches for the first occurrence of <code>elem</code>, beginning
- * the search at <code>index</code>.
+ * Searches for the first occurrence of {@code elem}, beginning
+ * the search at {@code index}.
*
* @param elem an desired component
* @param index the index from which to begin searching
- * @return the index where the first occurrence of <code>elem</code>
- * is found after <code>index</code>; returns <code>-1</code>
- * if the <code>elem</code> is not found in the list
+ * @return the index where the first occurrence of {@code elem}
+ * is found after {@code index}; returns {@code -1}
+ * if the {@code elem} is not found in the list
* @see Vector#indexOf(Object,int)
*/
public int indexOf(Object elem, int index) {
return delegate.indexOf(elem, index);
}
/**
- * Returns the index of the last occurrence of <code>elem</code>.
+ * Returns the index of the last occurrence of {@code elem}.
*
* @param elem the desired component
- * @return the index of the last occurrence of <code>elem</code>
- * in the list; returns <code>-1</code> if the object is not found
+ * @return the index of the last occurrence of {@code elem}
+ * in the list; returns {@code -1} if the object is not found
* @see Vector#lastIndexOf(Object)
*/
public int lastIndexOf(Object elem) {
return delegate.lastIndexOf(elem);
}
/**
- * Searches backwards for <code>elem</code>, starting from the
+ * Searches backwards for {@code elem}, starting from the
* specified index, and returns an index to it.
*
* @param elem the desired component
* @param index the index to start searching from
- * @return the index of the last occurrence of the <code>elem</code>
- * in this list at position less than <code>index</code>;
- * returns <code>-1</code> if the object is not found
+ * @return the index of the last occurrence of the {@code elem}
+ * in this list at position less than {@code index};
+ * returns {@code -1} if the object is not found
* @see Vector#lastIndexOf(Object,int)
*/
public int lastIndexOf(Object elem, int index) {
return delegate.lastIndexOf(elem, index);
}
/**
* Returns the component at the specified index.
- * Throws an <code>ArrayIndexOutOfBoundsException</code> if the index
+ * Throws an {@code ArrayIndexOutOfBoundsException} if the index
* is negative or not less than the size of the list.
* <blockquote>
* <b>Note:</b> Although this method is not deprecated, the preferred
- * method to use is <code>get(int)</code>, which implements the
- * <code>List</code> interface defined in the 1.2 Collections framework.
+ * method to use is {@code get(int)}, which implements the
+ * {@code List} interface defined in the 1.2 Collections framework.
* </blockquote>
*
* @param index an index into this list
* @return the component at the specified index
* @see #get(int)
@@ -268,42 +268,42 @@
return delegate.elementAt(index);
}
/**
* Returns the first component of this list.
- * Throws a <code>NoSuchElementException</code> if this
+ * Throws a {@code NoSuchElementException} if this
* vector has no components.
* @return the first component of this list
* @see Vector#firstElement()
*/
public E firstElement() {
return delegate.firstElement();
}
/**
* Returns the last component of the list.
- * Throws a <code>NoSuchElementException</code> if this vector
+ * Throws a {@code NoSuchElementException} if this vector
* has no components.
*
* @return the last component of the list
* @see Vector#lastElement()
*/
public E lastElement() {
return delegate.lastElement();
}
/**
- * Sets the component at the specified <code>index</code> of this
+ * Sets the component at the specified {@code index} of this
* list to be the specified element. The previous component at that
* position is discarded.
* <p>
- * Throws an <code>ArrayIndexOutOfBoundsException</code> if the index
+ * Throws an {@code ArrayIndexOutOfBoundsException} if the index
* is invalid.
* <blockquote>
* <b>Note:</b> Although this method is not deprecated, the preferred
- * method to use is <code>set(int,Object)</code>, which implements the
- * <code>List</code> interface defined in the 1.2 Collections framework.
+ * method to use is {@code set(int,Object)}, which implements the
+ * {@code List} interface defined in the 1.2 Collections framework.
* </blockquote>
*
* @param element what the component is to be set to
* @param index the specified index
* @see #set(int,Object)
@@ -315,16 +315,16 @@
}
/**
* Deletes the component at the specified index.
* <p>
- * Throws an <code>ArrayIndexOutOfBoundsException</code> if the index
+ * Throws an {@code ArrayIndexOutOfBoundsException} if the index
* is invalid.
* <blockquote>
* <b>Note:</b> Although this method is not deprecated, the preferred
- * method to use is <code>remove(int)</code>, which implements the
- * <code>List</code> interface defined in the 1.2 Collections framework.
+ * method to use is {@code remove(int)}, which implements the
+ * {@code List} interface defined in the 1.2 Collections framework.
* </blockquote>
*
* @param index the index of the object to remove
* @see #remove(int)
* @see Vector#removeElementAt(int)
@@ -334,18 +334,18 @@
fireIntervalRemoved(this, index, index);
}
/**
* Inserts the specified element as a component in this list at the
- * specified <code>index</code>.
+ * specified {@code index}.
* <p>
- * Throws an <code>ArrayIndexOutOfBoundsException</code> if the index
+ * Throws an {@code ArrayIndexOutOfBoundsException} if the index
* is invalid.
* <blockquote>
* <b>Note:</b> Although this method is not deprecated, the preferred
- * method to use is <code>add(int,Object)</code>, which implements the
- * <code>List</code> interface defined in the 1.2 Collections framework.
+ * method to use is {@code add(int,Object)}, which implements the
+ * {@code List} interface defined in the 1.2 Collections framework.
* </blockquote>
*
* @param element the component to insert
* @param index where to insert the new component
* @exception ArrayIndexOutOfBoundsException if the index was invalid
@@ -372,12 +372,12 @@
/**
* Removes the first (lowest-indexed) occurrence of the argument
* from this list.
*
* @param obj the component to be removed
- * @return <code>true</code> if the argument was a component of this
- * list; <code>false</code> otherwise
+ * @return {@code true} if the argument was a component of this
+ * list; {@code false} otherwise
* @see Vector#removeElement(Object)
*/
public boolean removeElement(Object obj) {
int index = indexOf(obj);
boolean rv = delegate.removeElement(obj);
@@ -390,12 +390,12 @@
/**
* Removes all components from this list and sets its size to zero.
* <blockquote>
* <b>Note:</b> Although this method is not deprecated, the preferred
- * method to use is <code>clear</code>, which implements the
- * <code>List</code> interface defined in the 1.2 Collections framework.
+ * method to use is {@code clear}, which implements the
+ * {@code List} interface defined in the 1.2 Collections framework.
* </blockquote>
*
* @see #clear()
* @see Vector#removeAllElements()
*/
@@ -437,13 +437,13 @@
}
/**
* Returns the element at the specified position in this list.
* <p>
- * Throws an <code>ArrayIndexOutOfBoundsException</code>
+ * Throws an {@code ArrayIndexOutOfBoundsException}
* if the index is out of range
- * (<code>index < 0 || index >= size()</code>).
+ * ({@code index < 0 || index >= size()}).
*
* @param index index of element to return
* @return the element at the specified position in this list
*/
public E get(int index) {
@@ -452,13 +452,13 @@
/**
* Replaces the element at the specified position in this list with the
* specified element.
* <p>
- * Throws an <code>ArrayIndexOutOfBoundsException</code>
+ * Throws an {@code ArrayIndexOutOfBoundsException}
* if the index is out of range
- * (<code>index < 0 || index >= size()</code>).
+ * ({@code index < 0 || index >= size()}).
*
* @param index index of element to replace
* @param element element to be stored at the specified position
* @return the element previously at the specified position
*/
@@ -470,13 +470,13 @@
}
/**
* Inserts the specified element at the specified position in this list.
* <p>
- * Throws an <code>ArrayIndexOutOfBoundsException</code> if the
+ * Throws an {@code ArrayIndexOutOfBoundsException} if the
* index is out of range
- * (<code>index < 0 || index > size()</code>).
+ * ({@code index < 0 || index > size()}).
*
* @param index index at which the specified element is to be inserted
* @param element element to be inserted
*/
public void add(int index, E element) {
@@ -486,13 +486,13 @@
/**
* Removes the element at the specified position in this list.
* Returns the element that was removed from the list.
* <p>
- * Throws an <code>ArrayIndexOutOfBoundsException</code>
+ * Throws an {@code ArrayIndexOutOfBoundsException}
* if the index is out of range
- * (<code>index < 0 || index >= size()</code>).
+ * ({@code index < 0 || index >= size()}).
*
* @param index the index of the element to removed
* @return the element previously at the specified position
*/
public E remove(int index) {
@@ -518,14 +518,14 @@
* 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.
* <p>
- * Throws an <code>ArrayIndexOutOfBoundsException</code>
+ * Throws an {@code ArrayIndexOutOfBoundsException}
* if the index was invalid.
- * Throws an <code>IllegalArgumentException</code> if
- * <code>fromIndex > toIndex</code>.
+ * Throws an {@code IllegalArgumentException} if
+ * {@code fromIndex > toIndex}.
*
* @param fromIndex the index of the lower end of the range
* @param toIndex the index of the upper end of the range
* @see #remove(int)
*/
< prev index next >