DefaultListModel still uses the old methods, so if you are using
a JList, you will need to use the old method names.
There are hints that they plan to change this, but still and interesting omission.
| Old Method | New Method |
|---|---|
| void addElement(Object) | boolean add(Object) |
| void copyInto(Object[]) | Object[] toArray() |
| Object elementAt(int) | Object get(int) |
| Enumeration elements() | Iterator iterator() br br br br>ListIterator listIterator() |
| void insertElementAt(Object, int) | void add(index, Object) |
| void removeAllElements() | void clear() |
| boolean removeElement(Object) | boolean remove(Object) |
| void removeElementAt(int) | void remove(int) |
| void setElementAt(int) | Object set(int, Object) |
Vector v1 = new Vector(); // allows old or new methods. List v2 = new Vector(); // allows only the new (List) methods.