javax.swing

Interface ListModel

public interface ListModel

The data model that is typically used in {@link JList}.
Method Summary
voidaddListDataListener(ListDataListener l)
Add a listener object to this model.
ObjectgetElementAt(int index)
Retrieves a data element at a specified index.
intgetSize()
Return the number of data elements in the list.
voidremoveListDataListener(ListDataListener l)
Add a listener object to this model.

Method Detail

addListDataListener

public void addListDataListener(ListDataListener l)
Add a listener object to this model. The listener will be called any time the set of elements in the model is changed.

Parameters: l The listener to add

getElementAt

public Object getElementAt(int index)
Retrieves a data element at a specified index.

Parameters: index The index of the element to retrieve

Returns: The data element at the specified index

getSize

public int getSize()
Return the number of data elements in the list.

Returns: The number of data elements in the list

removeListDataListener

public void removeListDataListener(ListDataListener l)
Add a listener object to this model. The listener will no longer be called when the set of elements in the model is changed.

Parameters: l The listener to remove