|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.swing.AbstractListModel
jview.MyList.MyListModel
public static class MyList.MyListModel
A list model that is based on a true array list. Allows also multiple replacements without notifying the listeners on every single add.
| Field Summary | |
|---|---|
private List<Object> |
delegate
We are backing up with this list. |
| Fields inherited from class javax.swing.AbstractListModel |
|---|
listenerList |
| Constructor Summary | |
|---|---|
MyList.MyListModel()
|
|
MyList.MyListModel(List<Object> pre)
Supported constructor either with a predfined list. |
|
| Method Summary | |
|---|---|
void |
add(int index,
Object obj)
Inserts the specified object as a component in this list at the specified index. |
void |
add(Object obj)
Adds the specified component to the end of this list. |
void |
addAll(Collection<Object> c)
|
void |
clear()
Removes all components from this list and sets its size to zero. |
boolean |
contains(Object elem)
Tests whether the specified object is a component in this list. |
Object |
getElementAt(int index)
Returns the component at the specified index. |
int |
getSize()
Returns the number of components in this list. |
int |
indexOf(Object elem)
Searches for the first occurrence of elem. |
boolean |
isEmpty()
Tests whether this list has any components. |
int |
lastIndexOf(Object elem)
Returns the index of the last occurrence of elem. |
void |
remove(int index)
Deletes the component at the specified index. |
boolean |
remove(Object obj)
Removes the first (lowest-indexed) occurrence of the argument from this list. |
void |
set(int index,
Object obj)
Sets the component at the specified index of this
list to be the specified object. |
int |
size()
Returns the number of components in this list. |
String |
toString()
Returns a string that displays and identifies this object's properties. |
| Methods inherited from class javax.swing.AbstractListModel |
|---|
addListDataListener, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, getListDataListeners, getListeners, removeListDataListener |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private List<Object> delegate
| Constructor Detail |
|---|
public MyList.MyListModel(List<Object> pre)
public MyList.MyListModel()
| Method Detail |
|---|
public int getSize()
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.
size()public Object getElementAt(int index)
index - an index into this list
ArrayIndexOutOfBoundsException - if the index
is negative or greater than the current size of this
list#get(int)public int size()
Vector#size()public boolean isEmpty()
true if and only if this list has
no components, that is, its size is zero;
false otherwiseVector#isEmpty()public boolean contains(Object elem)
elem - an object
true if the specified object
is the same as a component in this listVector#contains(Object)public int indexOf(Object elem)
elem.
elem - an object
-1 if the object is not foundVector#indexOf(Object)public int lastIndexOf(Object elem)
elem.
elem - the desired component
elem
in the list; returns -1 if the object
is not foundVector#lastIndexOf(Object)
public void set(int index,
Object obj)
index of this
list to be the specified object. The previous component at that
position is discarded.
Throws an ArrayIndexOutOfBoundsException if the index
is invalid.
obj - what the component is to be set toindex - the specified indexset(int,Object),
Vector#setElementAt(Object,int)public void remove(int index)
Throws an ArrayIndexOutOfBoundsException if the index
is invalid.
index - the index of the object to removeremove(int),
Vector#removeElementAt(int)
public void add(int index,
Object obj)
index.
Throws an ArrayIndexOutOfBoundsException if the index
is invalid.
obj - the component to insertindex - where to insert the new component
ArrayIndexOutOfBoundsException - if the index was invalidadd(int,Object),
Vector#insertElementAt(Object,int)public void add(Object obj)
obj - the component to be addedVector#addElement(Object)public boolean remove(Object obj)
obj - the component to be removed
true if the argument was a component of this
list; false otherwiseVector#removeElement(Object)public void clear()
Vector#removeAllElements()public String toString()
toString in class Objectpublic void addAll(Collection<Object> c)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||