public class RComboBoxModel
extends javax.swing.DefaultComboBoxModel
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(java.lang.Object[] items)
Creates a new combo box model with a maximum element count of
8. |
RComboBoxModel(java.util.Vector<?> v)
Creates a new combo box model with a maximum element count of
8. |
| Modifier and Type | Method and Description |
|---|---|
void |
addElement(java.lang.Object 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(java.lang.Object 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(java.lang.Object[] items)
8.items - The initial items to use to populate the combo box.public RComboBoxModel(java.util.Vector<?> v)
8.v - The initial items to use to populate the combo box.public void addElement(java.lang.Object anObject)
addElement in interface javax.swing.MutableComboBoxModeladdElement in class javax.swing.DefaultComboBoxModelanObject - The object to add.public int getMaxNumElements()
public void insertElementAt(java.lang.Object anObject,
int index)
ListDataListeners that the
item has been added.insertElementAt in interface javax.swing.MutableComboBoxModelinsertElementAt in class javax.swing.DefaultComboBoxModelanObject - The Object to be added.index - Location to add the object.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.