Constructor and Description |
---|
DefaultListModel()
Creates a new instance of DefaultListModel
|
DefaultListModel(Object[] items)
Creates a new instance of DefaultListModel
|
DefaultListModel(Vector items)
Creates a new instance of DefaultListModel
|
Modifier and Type | Method and Description |
---|---|
void |
addDataChangedListener(DataChangedListener l)
Invoked to indicate interest in future change events
|
void |
addItem(Object item)
Adds the specified item to the end of this list.
|
void |
addItemAtIndex(Object item,
int index)
Adding an item to list at given index
|
void |
addSelectionListener(SelectionListener l)
Invoked to indicate interest in future selection events
|
Object |
getItemAt(int index)
Returns the item at the given offset
|
int |
getSelectedIndex()
Returns the selected list offset
|
int |
getSize()
Returns the number of items in the list
|
void |
removeAll()
Removes all elements from the model
|
void |
removeDataChangedListener(DataChangedListener l)
Invoked to indicate no further interest in future change events
|
void |
removeItem(int index)
Removes the item at the specified position in this list.
|
void |
removeSelectionListener(SelectionListener l)
Invoked to indicate no further interest in future selection events
|
void |
setItem(int index,
Object item)
Change the item at the given index
|
void |
setSelectedIndex(int index)
Sets the selected list offset can be set to -1 to clear selection
|
public DefaultListModel()
public DefaultListModel(Vector items)
items
- the items in the modelpublic DefaultListModel(Object[] items)
items
- the items in the modelpublic Object getItemAt(int index)
ListModel
public int getSize()
ListModel
public int getSelectedIndex()
ListModel
getSelectedIndex
in interface ListModel
public void addItem(Object item)
ListModel
public void setItem(int index, Object item)
index
- the offset for the itemitem
- the value to setpublic void addItemAtIndex(Object item, int index)
item
- - the item to addindex
- - the index position in the listpublic void removeItem(int index)
ListModel
removeItem
in interface ListModel
index
- the index of the item to removedpublic void removeAll()
public void setSelectedIndex(int index)
ListModel
setSelectedIndex
in interface ListModel
index
- an index into this listpublic void addDataChangedListener(DataChangedListener l)
ListModel
addDataChangedListener
in interface ListModel
l
- a data changed listenerpublic void removeDataChangedListener(DataChangedListener l)
ListModel
removeDataChangedListener
in interface ListModel
l
- a data changed listenerpublic void addSelectionListener(SelectionListener l)
ListModel
addSelectionListener
in interface ListModel
l
- a selection listenerpublic void removeSelectionListener(SelectionListener l)
ListModel
removeSelectionListener
in interface ListModel
l
- a selection listener