K
- the type of keys maintained by the map backing this modelV
- the type of mapped valuesjava.awt.event.ActionListener
, java.io.Serializable
, java.util.EventListener
, javax.swing.ComboBoxModel
, javax.swing.ListModel
public class MapComboBoxModel<K,V> extends ListComboBoxModel<K>
ComboBoxModel
for Map
s. The model will always present a Map
consistently, once it is instantiated. However, unless the Map
is ordered, as a
java.util.TreeMap
is, the model is not guaranteed to present the maps in a consistent
order between instantiations.Modifier and Type | Field | Description |
---|---|---|
protected java.util.Map<K,V> |
map_data |
The map backing this model.
|
data, selected, UPDATE
Constructor | Description |
---|---|
MapComboBoxModel() |
Creates an empty model.
|
MapComboBoxModel(java.util.Map<K,V> map) |
Creates a model backed by the specified map.
|
Modifier and Type | Method | Description |
---|---|---|
void |
actionPerformed(java.awt.event.ActionEvent evt) |
|
int |
getSize() |
|
V |
getValue(int selectedItem) |
Selects an item from the model and returns that map value.
|
V |
getValue(java.lang.Object selectedItem) |
Selects an item from the model and returns that map value.
|
addListDataListener, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, getListDataListeners, getListeners, removeListDataListener
getElementAt, getSelectedItem, setSelectedItem
public int getSize()
getSize
in interface javax.swing.ListModel<K>
getSize
in class ListComboBoxModel<K>
public void actionPerformed(java.awt.event.ActionEvent evt)
actionPerformed
in interface java.awt.event.ActionListener
actionPerformed
in class ListComboBoxModel<K>
public V getValue(java.lang.Object selectedItem)
selectedItem
- the item to selectpublic V getValue(int selectedItem)
selectedItem
- selects the item at the specified index in this model