|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.swing.AbstractListModel
javax.swing.DefaultComboBoxModel
org.fife.ui.RComboBoxModel
A combo box model that limits the number of items the combo box will
"remember." You can use it like so:
RComboBoxModel model = new RComboBoxModel();
model.setMaxNumElements(10);
JComboBox comboBox = new JComboBox(model);
It also won't let you add an item to the combo box twice (i.e., no
duplicates), and it adds new items to the beginning of the list, not
the end (as JComboBox's do by default).
It defaults to 10 elements remembered.
| Field Summary |
| Fields inherited from class javax.swing.AbstractListModel |
listenerList |
| Constructor Summary | |
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. |
|
| Method Summary | |
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. |
| Methods inherited from class javax.swing.DefaultComboBoxModel |
getElementAt, getIndexOf, getSelectedItem, getSize, removeAllElements, removeElement, removeElementAt, setSelectedItem |
| Methods inherited from class javax.swing.AbstractListModel |
addListDataListener, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, getListDataListeners, getListeners, removeListDataListener |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface javax.swing.ListModel |
addListDataListener, removeListDataListener |
| Constructor Detail |
public 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.| Method Detail |
public void addElement(java.lang.Object anObject)
addElement in interface javax.swing.MutableComboBoxModelanObject - 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.MutableComboBoxModelanObject - 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.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||