com.ideanest.swing
Class ComboListModelAdapter
java.lang.Object
|
+--com.ideanest.swing.ComboListModelAdapter
- All Implemented Interfaces:
- javax.swing.ComboBoxModel, javax.swing.ListModel
- public class ComboListModelAdapter
- extends java.lang.Object
- implements javax.swing.ComboBoxModel
An adapter to turn a ListModel into a ComboBoxModel .
It just holds a reference to the selected item, and passes on all events from the
list model. It is not directly mutable, but will notify listeners
of any changes to the underlying list.
To use, take any ListModel and pass it as an argument to the
constructor.
- Author:
- Piotr Kaminski
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ComboListModelAdapter
public ComboListModelAdapter(javax.swing.ListModel listModel)
addListDataListener
public void addListDataListener(javax.swing.event.ListDataListener l)
- Specified by:
addListDataListener in interface javax.swing.ListModel
getElementAt
public java.lang.Object getElementAt(int index)
- Specified by:
getElementAt in interface javax.swing.ListModel
getSelectedItem
public java.lang.Object getSelectedItem()
- Specified by:
getSelectedItem in interface javax.swing.ComboBoxModel
getSize
public int getSize()
- Specified by:
getSize in interface javax.swing.ListModel
removeListDataListener
public void removeListDataListener(javax.swing.event.ListDataListener l)
- Specified by:
removeListDataListener in interface javax.swing.ListModel
setSelectedItem
public void setSelectedItem(java.lang.Object item)
- Specified by:
setSelectedItem in interface javax.swing.ComboBoxModel
|