charvax.swing

Class DefaultComboBoxModel

Implemented Interfaces:
ComboBoxModel, ListModel, MutableComboBoxModel

public class DefaultComboBoxModel
extends AbstractListModel
implements MutableComboBoxModel

The default model for combo boxes.

Field Summary

Fields inherited from class charvax.swing.AbstractListModel

_listeners

Constructor Summary

DefaultComboBoxModel()
Default constructor
DefaultComboBoxModel(Object[] items_)
Constructs a DefaultComboBoxModel object initialized with an array of objects.
DefaultComboBoxModel(Vector items_)
Constructs a DefaultComboBoxModel object initialized with a vector.

Method Summary

void
addElement(Object obj_)
Add the specified object to the end of the list.
boolean
contains(Object elem_)
Returns true if the specified element is in the list.
Object
getElementAt(int index_)
Returns the value at the specified index.
Object
getSelectedItem()
Return the selected item.
int
getSize()
Returns the length of the list.
int
indexOf(Object elem_)
Returns the index of the first occurrence of the specified object.
void
insertElementAt(Object obj_, int index_)
Insert an item at the specified index.
void
removeAllElements()
Removes all elements from this list and sets its size to zero.
void
removeElement(Object obj_)
Remove the specified object from the model.
void
removeElementAt(int index_)
Deletes the component at the specified index.
void
setSelectedItem(Object anItem_)
Set the selected item

Methods inherited from class charvax.swing.AbstractListModel

addListDataListener, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, removeListDataListener

Constructor Details

DefaultComboBoxModel

public DefaultComboBoxModel()
Default constructor

DefaultComboBoxModel

public DefaultComboBoxModel(Object[] items_)
Constructs a DefaultComboBoxModel object initialized with an array of objects.

DefaultComboBoxModel

public DefaultComboBoxModel(Vector items_)
Constructs a DefaultComboBoxModel object initialized with a vector.

Method Details

addElement

public void addElement(Object obj_)
Add the specified object to the end of the list.
Specified by:
addElement in interface MutableComboBoxModel

contains

public boolean contains(Object elem_)
Returns true if the specified element is in the list.

getElementAt

public Object getElementAt(int index_)
Returns the value at the specified index.
Specified by:
getElementAt in interface ListModel

getSelectedItem

public Object getSelectedItem()
Return the selected item.
Specified by:
getSelectedItem in interface ComboBoxModel

getSize

public int getSize()
Returns the length of the list.
Specified by:
getSize in interface ListModel

indexOf

public int indexOf(Object elem_)
Returns the index of the first occurrence of the specified object.

insertElementAt

public void insertElementAt(Object obj_,
                            int index_)
Insert an item at the specified index.
Specified by:
insertElementAt in interface MutableComboBoxModel

removeAllElements

public void removeAllElements()
Removes all elements from this list and sets its size to zero.

removeElement

public void removeElement(Object obj_)
Remove the specified object from the model.
Specified by:
removeElement in interface MutableComboBoxModel

removeElementAt

public void removeElementAt(int index_)
Deletes the component at the specified index.
Specified by:
removeElementAt in interface MutableComboBoxModel

setSelectedItem

public void setSelectedItem(Object anItem_)
Set the selected item
Specified by:
setSelectedItem in interface ComboBoxModel