public class IstiListComboBoxModel
extends javax.swing.AbstractListModel
implements javax.swing.MutableComboBoxModel
Constructor and Description |
---|
IstiListComboBoxModel(java.util.List objects,
java.lang.Object selectedObject)
Constructs a station combo box model.
|
Modifier and Type | Method and Description |
---|---|
void |
addElement(java.lang.Object obj)
Adds an item at the end of the model.
|
java.lang.Object |
getElementAt(int index)
Gets the value at the specified index.
|
java.lang.Object |
getSelectedItem()
Gets the selected item.
|
int |
getSize()
Gets the length of the list.
|
void |
insertElementAt(java.lang.Object obj,
int index)
Adds an item at a specific index.
|
void |
removeAllElements()
Empties the list.
|
void |
removeElement(java.lang.Object obj)
Removes an item from the model.
|
void |
removeElementAt(int index)
Removes an item at a specific index.
|
void |
setSelectedItem(java.lang.Object anItem)
Set the selected item.
|
addListDataListener, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, getListDataListeners, getListeners, removeListDataListener
public IstiListComboBoxModel(java.util.List objects, java.lang.Object selectedObject)
objects
- the list of objects.selectedObject
- the selected object.public void addElement(java.lang.Object obj)
addElement
in interface javax.swing.MutableComboBoxModel
obj
- the Object
to be addedpublic java.lang.Object getElementAt(int index)
getElementAt
in interface javax.swing.ListModel
index
- the requested index.index
.public java.lang.Object getSelectedItem()
getSelectedItem
in interface javax.swing.ComboBoxModel
null
if there is no selection.public int getSize()
getSize
in interface javax.swing.ListModel
public void insertElementAt(java.lang.Object obj, int index)
insertElementAt
in interface javax.swing.MutableComboBoxModel
obj
- the Object
to be addedindex
- location to add the objectpublic void removeAllElements()
public void removeElement(java.lang.Object obj)
removeElement
in interface javax.swing.MutableComboBoxModel
obj
- the Object
to be removedpublic void removeElementAt(int index)
ListDataListener
s that the
item has been removed.removeElementAt
in interface javax.swing.MutableComboBoxModel
index
- location of object to be removedpublic void setSelectedItem(java.lang.Object anItem)
setSelectedItem
in interface javax.swing.ComboBoxModel
anItem
- the selected item or null
for no selection.