E
- the element type of the underlying list and this modelpublic class ListBackedListModel<E> extends javax.swing.AbstractListModel<E>
ListModel
that always reflects the contents of a List
.
Note that this model does reflect changes in the underlying list that occur after the creation of this object but will not inform its
listeners on these. (The underlying list cannot be monitored.) The methods add(Object)
, add(int, Object)
,
set(int, Object)
, remove(int)
and clear()
allow to edit the underlying list and notify all listeners
registered to this model and the same time. It is recommended to use these methods instead of modifying the list directly if changes
should be made to a list that is currently displayed in the GUI, e.g., in an instance of JList
.
Constructor and Description |
---|
ListBackedListModel(java.util.List<E> list) |
Modifier and Type | Method and Description |
---|---|
boolean |
add(E e) |
void |
add(int index,
E element) |
void |
clear() |
E |
getElementAt(int index) |
java.util.List<E> |
getList() |
int |
getSize() |
E |
remove(int index) |
E |
set(int index,
E element) |
void |
setList(java.util.List<E> list) |
public ListBackedListModel(java.util.List<E> list)
public E getElementAt(int index)
public int getSize()
public void clear()