E
- the type of elements maintained by the list backing this modelpublic class ListComboBoxModel<E> extends AbstractListModel implements ComboBoxModel, ActionListener
ComboBoxModel
for List
s.Modifier and Type | Field and Description |
---|---|
protected List<E> |
data
A reference to the list backing this model.
|
protected E |
selected
The currently selected item.
|
static String |
UPDATE
A key used to notify the model that the backing
List has changed. |
listenerList
Constructor and Description |
---|
ListComboBoxModel(List<E> list)
Creates a
ListComboBoxModel backed by the supplied list . |
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(ActionEvent evt) |
E |
getElementAt(int index) |
E |
getSelectedItem() |
int |
getSize() |
void |
setSelectedItem(Object item)
Set the selected item.
|
addListDataListener, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, getListDataListeners, getListeners, removeListDataListener
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addListDataListener, removeListDataListener
public static final String UPDATE
List
has changed.protected final List<E> data
This model does not make a copy of the list, so any changes in the list without synchronizing the model may have drastic effects.
public ListComboBoxModel(List<E> list)
ListComboBoxModel
backed by the supplied list
.list
- the list backing this modelNullPointerException
- if list
is null
public void setSelectedItem(Object item)
ListDataListener
s that the contents have changed.setSelectedItem
in interface ComboBoxModel
item
- the list object to select or null
to clear the
selectionClassCastException
- if item
is not of type E
public E getSelectedItem()
getSelectedItem
in interface ComboBoxModel
public E getElementAt(int index)
getElementAt
in interface ListModel
public void actionPerformed(ActionEvent evt)
actionPerformed
in interface ActionListener
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses