Class AbstractComboBoxModel<T>
- java.lang.Object
-
- javax.swing.AbstractListModel<T>
-
- de.alpharogroup.swing.combobox.model.AbstractComboBoxModel<T>
-
- Type Parameters:
T- the generic type of the Model
- All Implemented Interfaces:
java.awt.event.ActionListener,java.io.Serializable,java.util.EventListener,javax.swing.ComboBoxModel<T>,javax.swing.ListModel<T>
- Direct Known Subclasses:
EnumComboBoxModel,StringComboBoxModel
public abstract class AbstractComboBoxModel<T> extends javax.swing.AbstractListModel<T> implements javax.swing.ComboBoxModel<T>, java.awt.event.ActionListenerThe abstract classAbstractComboBoxModelcontains the data for a combo list and the current selected item.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.List<T>comboListThe generic combo list.protected TselectedItemThe the current selected item.
-
Constructor Summary
Constructors Constructor Description AbstractComboBoxModel()Instantiates a newAbstractComboBoxModelwith a new list.AbstractComboBoxModel(java.util.List<T> comboList)Instantiates a newAbstractComboBoxModelfrom the given list.AbstractComboBoxModel(java.util.List<T> comboList, T selectedItem)Instantiates a newAbstractComboBoxModelfrom the given arguments.AbstractComboBoxModel(java.util.Set<T> set)Instantiates a newAbstractComboBoxModelfrom the givenSet.AbstractComboBoxModel(java.util.Set<T> set, T selectedItem)Instantiates a newAbstractComboBoxModelfrom the givenSet.AbstractComboBoxModel(T[] comboArray)Instantiates a newAbstractComboBoxModelfrom the given array.AbstractComboBoxModel(T[] comboArray, T selectedItem)Instantiates a newAbstractComboBoxModelfrom the given arguments.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidactionPerformed(java.awt.event.ActionEvent evt)TgetElementAt(int index)intgetSize()voidsetComboSet(java.util.Set<T> set)Sets the combo list from the given set.voidsetSelectedItem(java.lang.Object anItem)-
Methods inherited from class javax.swing.AbstractListModel
addListDataListener, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, getListDataListeners, getListeners, removeListDataListener
-
-
-
-
Constructor Detail
-
AbstractComboBoxModel
public AbstractComboBoxModel()
Instantiates a newAbstractComboBoxModelwith a new list.
-
AbstractComboBoxModel
public AbstractComboBoxModel(java.util.List<T> comboList)
Instantiates a newAbstractComboBoxModelfrom the given list.- Parameters:
comboList- the list
-
AbstractComboBoxModel
public AbstractComboBoxModel(java.util.List<T> comboList, T selectedItem)
Instantiates a newAbstractComboBoxModelfrom the given arguments.- Parameters:
comboList- the combo listselectedItem- the selected item
-
AbstractComboBoxModel
public AbstractComboBoxModel(java.util.Set<T> set)
Instantiates a newAbstractComboBoxModelfrom the givenSet.- Parameters:
set- the combo set
-
AbstractComboBoxModel
public AbstractComboBoxModel(java.util.Set<T> set, T selectedItem)
Instantiates a newAbstractComboBoxModelfrom the givenSet.- Parameters:
set- the combo setselectedItem- the selected item
-
AbstractComboBoxModel
public AbstractComboBoxModel(T[] comboArray)
Instantiates a newAbstractComboBoxModelfrom the given array.- Parameters:
comboArray- the combo array
-
AbstractComboBoxModel
public AbstractComboBoxModel(T[] comboArray, T selectedItem)
Instantiates a newAbstractComboBoxModelfrom the given arguments.- Parameters:
comboArray- the combo arrayselectedItem- the selected item
-
-
Method Detail
-
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent evt)
- Specified by:
actionPerformedin interfacejava.awt.event.ActionListener
-
getElementAt
public T getElementAt(int index)
- Specified by:
getElementAtin interfacejavax.swing.ListModel<T>
-
getSize
public int getSize()
- Specified by:
getSizein interfacejavax.swing.ListModel<T>
-
setComboSet
public void setComboSet(java.util.Set<T> set)
Sets the combo list from the given set.- Parameters:
set- the new combo set
-
setSelectedItem
public void setSelectedItem(java.lang.Object anItem)
- Specified by:
setSelectedItemin interfacejavax.swing.ComboBoxModel<T>
-
-