org.jdesktop.swingx.combobox
Class ListComboBoxModel<E>
- java.lang.Object
-
- javax.swing.AbstractListModel
-
- org.jdesktop.swingx.combobox.ListComboBoxModel<E>
-
- Type Parameters:
E- the type of elements maintained by the list backing this model
- All Implemented Interfaces:
- java.awt.event.ActionListener, java.io.Serializable, java.util.EventListener, javax.swing.ComboBoxModel, javax.swing.ListModel
- Direct Known Subclasses:
- EnumComboBoxModel, MapComboBoxModel
public class ListComboBoxModel<E> extends javax.swing.AbstractListModel implements javax.swing.ComboBoxModel, java.awt.event.ActionListenerAComboBoxModelforLists.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field and Description static java.lang.StringUPDATEA key used to notify the model that the backingListhas changed.
-
Constructor Summary
Constructors Constructor and Description ListComboBoxModel(java.util.List<E> list)Creates aListComboBoxModelbacked by the suppliedlist.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidactionPerformed(java.awt.event.ActionEvent evt)EgetElementAt(int index)EgetSelectedItem()intgetSize()voidsetSelectedItem(java.lang.Object item)Set the selected item.-
Methods inherited from class javax.swing.AbstractListModel
addListDataListener, getListDataListeners, getListeners, removeListDataListener
-
-
-
-
Field Detail
-
UPDATE
public static final java.lang.String UPDATE
A key used to notify the model that the backingListhas changed.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ListComboBoxModel
public ListComboBoxModel(java.util.List<E> list)
Creates aListComboBoxModelbacked by the suppliedlist.- Parameters:
list- the list backing this model- Throws:
java.lang.NullPointerException- iflistisnull
-
-
Method Detail
-
setSelectedItem
public void setSelectedItem(java.lang.Object item)
Set the selected item. The implementation of this method should notify all registeredListDataListeners that the contents have changed.- Specified by:
setSelectedItemin interfacejavax.swing.ComboBoxModel- Parameters:
item- the list object to select ornullto clear the selection- Throws:
java.lang.ClassCastException- ifitemis not of typeE
-
getSelectedItem
public E getSelectedItem()
- Specified by:
getSelectedItemin interfacejavax.swing.ComboBoxModel
-
getElementAt
public E getElementAt(int index)
- Specified by:
getElementAtin interfacejavax.swing.ListModel
-
getSize
public int getSize()
- Specified by:
getSizein interfacejavax.swing.ListModel
-
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent evt)
- Specified by:
actionPerformedin interfacejava.awt.event.ActionListener
-
-
DataMelt 3.0 © DataMelt by jWork.ORG