public class CheckBoxList.CheckBoxListModel extends DefaultListModel
Constructor and Description |
---|
CheckBoxList.CheckBoxListModel()
initializes the model with no data.
|
CheckBoxList.CheckBoxListModel(Object[] listData)
Constructs a CheckBoxListModel from an array of objects and then applies
setModel to it.
|
CheckBoxList.CheckBoxListModel(Vector listData)
Constructs a CheckBoxListModel from a Vector and then applies setModel
to it.
|
Modifier and Type | Method and Description |
---|---|
void |
add(int index,
Object element)
Inserts the specified element at the specified position in this list.
|
void |
addElement(Object obj)
Adds the specified component to the end of this list.
|
boolean |
contains(Object elem)
Tests whether the specified object is a component in this list.
|
void |
copyInto(Object[] anArray)
Copies the components of this list into the specified array.
|
Object |
elementAt(int index)
Returns the component at the specified index.
|
Object |
firstElement()
Returns the first component of this list.
|
Object |
get(int index)
Returns the element at the specified position in this list.
|
boolean |
getChecked(int index)
returns the checked state of the element at the given index
|
Object |
getElementAt(int index)
Returns the component at the specified index.
|
int |
indexOf(Object elem)
Searches for the first occurrence of elem.
|
int |
indexOf(Object elem,
int index)
Searches for the first occurrence of elem, beginning the search at index.
|
void |
insertElementAt(Object obj,
int index)
Inserts the specified object as a component in this list at the
specified index.
|
Object |
lastElement()
Returns the last component of the list.
|
int |
lastIndexOf(Object elem)
Returns the index of the last occurrence of elem.
|
int |
lastIndexOf(Object elem,
int index)
Searches backwards for elem, starting from the specified index,
and returns an index to it.
|
Object |
remove(int index)
Removes the element at the specified position in this list.
|
boolean |
removeElement(Object obj)
Removes the first (lowest-indexed) occurrence of the argument from this
list.
|
Object |
set(int index,
Object element)
Replaces the element at the specified position in this list with the
specified element.
|
void |
setChecked(int index,
boolean checked)
sets the checked state of the element at the given index
|
void |
setElementAt(Object obj,
int index)
Sets the component at the specified index of this list to be the
specified object.
|
Object[] |
toArray()
Returns an array containing all of the elements in this list in the
correct order.
|
capacity, clear, elements, ensureCapacity, getSize, isEmpty, removeAllElements, removeElementAt, removeRange, setSize, size, toString, trimToSize
addListDataListener, getListDataListeners, getListeners, removeListDataListener
public CheckBoxList.CheckBoxListModel()
public CheckBoxList.CheckBoxListModel(Object[] listData)
listData
- the data to usepublic CheckBoxList.CheckBoxListModel(Vector listData)
public void add(int index, Object element)
add
in class DefaultListModel
index
- index at which the specified element is to be insertedelement
- element to be insertedpublic void addElement(Object obj)
addElement
in class DefaultListModel
obj
- the component to be addedpublic boolean contains(Object elem)
contains
in class DefaultListModel
elem
- the element to checkpublic void copyInto(Object[] anArray)
copyInto
in class DefaultListModel
anArray
- the array into which the components get copiedIndexOutOfBoundsException
- if the array is not big enoughpublic Object elementAt(int index)
elementAt
in class DefaultListModel
index
- an index into this listArrayIndexOutOfBoundsException
public Object firstElement()
firstElement
in class DefaultListModel
NoSuchElementException
public Object get(int index)
get
in class DefaultListModel
index
- of element to returnArrayIndexOutOfBoundsException
public Object getElementAt(int index)
getElementAt
in interface ListModel
getElementAt
in class DefaultListModel
index
- an index into this listArrayIndexOutOfBoundsException
public int indexOf(Object elem)
indexOf
in class DefaultListModel
elem
- an objectpublic int indexOf(Object elem, int index)
indexOf
in class DefaultListModel
elem
- the desired componentindex
- the index from which to begin searchingpublic void insertElementAt(Object obj, int index)
insertElementAt
in class DefaultListModel
obj
- the component to insertindex
- where to insert the new componentArrayIndexOutOfBoundsException
public Object lastElement()
lastElement
in class DefaultListModel
NoSuchElementException
public int lastIndexOf(Object elem)
lastIndexOf
in class DefaultListModel
elem
- the desired componentpublic int lastIndexOf(Object elem, int index)
lastIndexOf
in class DefaultListModel
elem
- the desired componentindex
- the index to start searching frompublic Object remove(int index)
remove
in class DefaultListModel
index
- the index of the element to removedArrayIndexOutOfBoundsException
public boolean removeElement(Object obj)
removeElement
in class DefaultListModel
obj
- the component to be removedpublic Object set(int index, Object element)
set
in class DefaultListModel
index
- index of element to replaceelement
- element to be stored at the specified positionArrayIndexOutOfBoundsException
public void setElementAt(Object obj, int index)
setElementAt
in class DefaultListModel
obj
- what the component is to be set toindex
- the specified indexArrayIndexOutOfBoundsException
public Object[] toArray()
toArray
in class DefaultListModel
public boolean getChecked(int index)
index
- the index of the element to return the checked state forpublic void setChecked(int index, boolean checked)
index
- the index of the element to set the checked state forchecked
- the new checked stateCopyright © 2012 University of Waikato, Hamilton, NZ. All Rights Reserved.