public class KeyedComboBoxModel extends Object implements ComboBoxModel
| Constructor and Description |
|---|
KeyedComboBoxModel()
Creates a new keyed combobox model.
|
KeyedComboBoxModel(Object[] keys,
Object[] values)
Creates a new keyed combobox model for the given keys and values.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(Object key,
Object cbitem)
Adds a new entry to the model.
|
void |
addListDataListener(ListDataListener l)
Adds a listener to the list that's notified each time a change to the data
model occurs.
|
void |
clear()
Removes all entries from the model.
|
int |
findElementIndex(Object key)
Tries to find the index of element with the given key.
|
protected void |
fireListDataEvent(ListDataEvent evt)
Notifies all registered list data listener of the given event.
|
Object |
getElementAt(int index)
Returns the value at the specified index.
|
Object |
getKeyAt(int index)
Returns the key from the given index.
|
Object |
getSelectedItem()
Returns the selected item.
|
Object |
getSelectedKey()
Returns the selected data element or null if none is set.
|
int |
getSize()
Returns the length of the list.
|
void |
removeDataElement(Object key)
Removes an entry from the model.
|
void |
removeListDataListener(ListDataListener l)
Removes a listener from the list that's notified each time a change to
the data model occurs.
|
void |
setAllowOtherValue(boolean allowOtherValue) |
void |
setData(Object[] keys,
Object[] values)
Replaces the data in this combobox model.
|
void |
setSelectedItem(Object anItem)
Set the selected item.
|
void |
setSelectedKey(Object anItem)
Defines the selected key.
|
public KeyedComboBoxModel()
public void setData(Object[] keys, Object[] values)
keys - the keysvalues - the valuesprotected void fireListDataEvent(ListDataEvent evt)
evt - the event.public Object getSelectedItem()
getSelectedItem in interface ComboBoxModelnull if there is no selectionpublic void setSelectedKey(Object anItem)
anItem - the new selected item.public void setSelectedItem(Object anItem)
ListDataListeners that the contents have
changed.setSelectedItem in interface ComboBoxModelanItem - the list object to select or null to clear the
selectionpublic void setAllowOtherValue(boolean allowOtherValue)
allowOtherValue - public void addListDataListener(ListDataListener l)
addListDataListener in interface ListModell - the ListDataListener to be addedpublic Object getElementAt(int index)
getElementAt in interface ListModelindex - the requested indexindexpublic Object getKeyAt(int index)
index - the index of the key.public Object getSelectedKey()
public int getSize()
public void removeListDataListener(ListDataListener l)
removeListDataListener in interface ListModell - the ListDataListener to be removedpublic int findElementIndex(Object key)
key - the key for the element to be searched.public void removeDataElement(Object key)
key - the keypublic void add(Object key, Object cbitem)
key - the keycbitem - the display value.public void clear()
Copyright © 2009-2012 jtstand.com. All Rights Reserved.