E - The type of item in the combo box.public class RComboBoxModel<E>
extends javax.swing.DefaultComboBoxModel<E>
RComboBoxModel model = new RComboBoxModel();model.setMaxNumElements(10);JComboBox comboBox = new JComboBox(model);JComboBox's do by default).| Constructor and Description |
|---|
RComboBoxModel()
Creates a new combo box model with a maximum element count of
8. |
RComboBoxModel(E[] items)
Creates a new combo box model with a maximum element count of
8. |
RComboBoxModel(java.util.Vector<E> v)
Creates a new combo box model with a maximum element count of
8. |
| Modifier and Type | Method and Description |
|---|---|
void |
addElement(E anObject)
Adds the object (if it's not already in the list) to the front of
the list.
|
int |
getMaxNumElements()
Returns the maximum number of items this combo box can hold.
|
void |
insertElementAt(E anObject,
int index)
Adds an item at a specified index.
|
void |
setMaxNumElements(int numElements)
Sets the maximum number of items this combo box can hold.
|
getElementAt, getIndexOf, getSelectedItem, getSize, removeAllElements, removeElement, removeElementAt, setSelectedItemaddListDataListener, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, getListDataListeners, getListeners, removeListDataListenerpublic RComboBoxModel()
8.public RComboBoxModel(E[] items)
8.items - The initial items to use to populate the combo box.public RComboBoxModel(java.util.Vector<E> v)
8.v - The initial items to use to populate the combo box.public void addElement(E anObject)
public int getMaxNumElements()
public void insertElementAt(E anObject, int index)
ListDataListeners that the
item has been added.public void setMaxNumElements(int numElements)
numElements - The maximum number of items this combo box can hold.
If numElements <= 0, then the capacity
of this combo box is set to 4.