APIdia Launch Partner
Top Description Methods
javax.swing

public Interface ListModel<E>

Known Direct Subinterfaces
javax.swing.ComboBoxModel
Known Direct Implementers
javax.swing.plaf.basic.BasicComboPopup.EmptyListModelClass, javax.swing.AbstractListModel
Type Parameters
<E>
the type of the elements of this model
Imports
javax.swing.event.ListDataListener

This interface defines the methods components like JList use to get the value of each cell in a list and the length of the list. Logically the model is a vector, indices vary from 0 to ListModel.getSize() - 1. Any change to the contents or length of the data model must be reported to all of the ListDataListeners.
Author
Hans Muller
Since
1.2
See Also
JList

Method Summary

Modifier and TypeMethod and Description
public void
addListDataListener(ListDataListener
the ListDataListener to be added
l
)

Adds a listener to the list that's notified each time a change to the data model occurs.

public E

Returns:

the value at index
getElementAt
(int
the requested index
index
)

Returns the value at the specified index.

public int

Returns:

the length of the list
getSize
()

Returns the length of the list.

public void
removeListDataListener(ListDataListener
the ListDataListener to be removed
l
)

Removes a listener from the list that's notified each time a change to the data model occurs.

Method Detail

addListDataListenerback to summary
public void addListDataListener(ListDataListener l)

Adds a listener to the list that's notified each time a change to the data model occurs.

Parameters
l:ListDataListener

the ListDataListener to be added

getElementAtback to summary
public E getElementAt(int index)

Returns the value at the specified index.

Parameters
index:int

the requested index

Returns:E

the value at index

getSizeback to summary
public int getSize()

Returns the length of the list.

Returns:int

the length of the list

removeListDataListenerback to summary
public void removeListDataListener(ListDataListener l)

Removes a listener from the list that's notified each time a change to the data model occurs.

Parameters
l:ListDataListener

the ListDataListener to be removed