public class MapComboBoxModel
extends javax.swing.AbstractListModel
implements java.lang.Cloneable, javax.swing.ComboBoxModel
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ID
Class identification name with source code version and date.
|
Constructor and Description |
---|
MapComboBoxModel()
Creates a new empty map ComboBox model.
|
MapComboBoxModel(java.util.Map items)
Create a new Map ComboBox model with a map of key value pairs.
|
MapComboBoxModel(java.util.Map items,
java.util.Comparator comparator) |
Modifier and Type | Method and Description |
---|---|
void |
addItem(java.lang.Object key,
java.lang.Object val)
Adds a key-value item pair.
|
java.lang.Object |
clone()
Returns a clone of this model.
|
java.lang.Object |
getElementAt(int index) |
java.lang.Object |
getSelectedItem()
Get the currently selected item.
|
int |
getSize()
Gets the size of the model.
|
java.lang.Object |
getValue() |
java.lang.Object |
getValue(int index) |
java.lang.Object |
getValue(java.lang.Object key) |
void |
setItems(java.util.Map items)
Initializes the model with a map of items.
|
void |
setItems(java.util.Map items,
java.util.Comparator comparator)
Initializes the model with a map of items.
|
void |
setSelectedItem(java.lang.Object item)
Sets the currently selected item.
|
void |
setSelectedValue(java.lang.Object key)
Sets the currently selected value.
|
addListDataListener, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, getListDataListeners, getListeners, removeListDataListener
public static final java.lang.String ID
public MapComboBoxModel()
public MapComboBoxModel(java.util.Map items)
items
- Key value pairspublic MapComboBoxModel(java.util.Map items, java.util.Comparator comparator)
public void setItems(java.util.Map items)
items
- Key value pairs.setItems(Map,Comparator)
public void setItems(java.util.Map items, java.util.Comparator comparator)
items
- Key value pairs.comparator
- a comparator for the keys.public java.lang.Object getSelectedItem()
getSelectedItem
in interface javax.swing.ComboBoxModel
public void setSelectedItem(java.lang.Object item)
setSelectedItem
in interface javax.swing.ComboBoxModel
item
- The item to select.public void setSelectedValue(java.lang.Object key)
key
- Key of item to select.public int getSize()
getSize
in interface javax.swing.ListModel
public java.lang.Object getElementAt(int index)
getElementAt
in interface javax.swing.ListModel
public java.lang.Object getValue()
public java.lang.Object getValue(int index)
public java.lang.Object getValue(java.lang.Object key)
public void addItem(java.lang.Object key, java.lang.Object val)
key
- The key.val
- The value.public java.lang.Object clone()
clone
in class java.lang.Object
Copyright \ (C) Arizona Board of Regents on behalf of the \ Planetary Image Research Laboratory, Lunar and \ Planetary Laboratory at the University of Arizona