public class CheckBoxList.CheckBoxListModel
extends javax.swing.DefaultListModel
Constructor and Description |
---|
CheckBoxListModel()
initializes the model with no data.
|
CheckBoxListModel(java.lang.Object[] listData)
Constructs a CheckBoxListModel from an array of objects and then applies
setModel to it.
|
CheckBoxListModel(java.util.Vector listData)
Constructs a CheckBoxListModel from a Vector and then applies setModel to
it.
|
Modifier and Type | Method and Description |
---|---|
void |
add(int index,
java.lang.Object element)
Inserts the specified element at the specified position in this list.
|
void |
addElement(java.lang.Object obj)
Adds the specified component to the end of this list.
|
boolean |
contains(java.lang.Object elem)
Tests whether the specified object is a component in this list.
|
void |
copyInto(java.lang.Object[] anArray)
Copies the components of this list into the specified array.
|
java.lang.Object |
elementAt(int index)
Returns the component at the specified index.
|
java.lang.Object |
firstElement()
Returns the first component of this list.
|
java.lang.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
|
java.lang.Object |
getElementAt(int index)
Returns the component at the specified index.
|
int |
indexOf(java.lang.Object elem)
Searches for the first occurrence of elem.
|
int |
indexOf(java.lang.Object elem,
int index)
Searches for the first occurrence of elem, beginning the search at index.
|
void |
insertElementAt(java.lang.Object obj,
int index)
Inserts the specified object as a component in this list at the specified
index.
|
java.lang.Object |
lastElement()
Returns the last component of the list.
|
int |
lastIndexOf(java.lang.Object elem)
Returns the index of the last occurrence of elem.
|
int |
lastIndexOf(java.lang.Object elem,
int index)
Searches backwards for elem, starting from the specified index, and
returns an index to it.
|
java.lang.Object |
remove(int index)
Removes the element at the specified position in this list.
|
boolean |
removeElement(java.lang.Object obj)
Removes the first (lowest-indexed) occurrence of the argument from this
list.
|
java.lang.Object |
set(int index,
java.lang.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(java.lang.Object obj,
int index)
Sets the component at the specified index of this list to be the
specified object.
|
java.lang.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
public CheckBoxListModel()
public CheckBoxListModel(java.lang.Object[] listData)
listData
- the data to usepublic CheckBoxListModel(java.util.Vector listData)
public void add(int index, java.lang.Object element)
add
in class javax.swing.DefaultListModel
index
- index at which the specified element is to be insertedelement
- element to be insertedpublic void addElement(java.lang.Object obj)
addElement
in class javax.swing.DefaultListModel
obj
- the component to be addedpublic boolean contains(java.lang.Object elem)
contains
in class javax.swing.DefaultListModel
elem
- the element to checkpublic void copyInto(java.lang.Object[] anArray)
copyInto
in class javax.swing.DefaultListModel
anArray
- the array into which the components get copiedjava.lang.IndexOutOfBoundsException
- if the array is not big enoughpublic java.lang.Object elementAt(int index)
elementAt
in class javax.swing.DefaultListModel
index
- an index into this listjava.lang.ArrayIndexOutOfBoundsException
public java.lang.Object firstElement()
firstElement
in class javax.swing.DefaultListModel
java.util.NoSuchElementException
public java.lang.Object get(int index)
get
in class javax.swing.DefaultListModel
index
- of element to returnjava.lang.ArrayIndexOutOfBoundsException
public java.lang.Object getElementAt(int index)
getElementAt
in interface javax.swing.ListModel
getElementAt
in class javax.swing.DefaultListModel
index
- an index into this listjava.lang.ArrayIndexOutOfBoundsException
public int indexOf(java.lang.Object elem)
indexOf
in class javax.swing.DefaultListModel
elem
- an objectpublic int indexOf(java.lang.Object elem, int index)
indexOf
in class javax.swing.DefaultListModel
elem
- the desired componentindex
- the index from which to begin searchingpublic void insertElementAt(java.lang.Object obj, int index)
insertElementAt
in class javax.swing.DefaultListModel
obj
- the component to insertindex
- where to insert the new componentjava.lang.ArrayIndexOutOfBoundsException
public java.lang.Object lastElement()
lastElement
in class javax.swing.DefaultListModel
java.util.NoSuchElementException
public int lastIndexOf(java.lang.Object elem)
lastIndexOf
in class javax.swing.DefaultListModel
elem
- the desired componentpublic int lastIndexOf(java.lang.Object elem, int index)
lastIndexOf
in class javax.swing.DefaultListModel
elem
- the desired componentindex
- the index to start searching frompublic java.lang.Object remove(int index)
remove
in class javax.swing.DefaultListModel
index
- the index of the element to removedjava.lang.ArrayIndexOutOfBoundsException
public boolean removeElement(java.lang.Object obj)
removeElement
in class javax.swing.DefaultListModel
obj
- the component to be removedpublic java.lang.Object set(int index, java.lang.Object element)
set
in class javax.swing.DefaultListModel
index
- index of element to replaceelement
- element to be stored at the specified positionjava.lang.ArrayIndexOutOfBoundsException
public void setElementAt(java.lang.Object obj, int index)
setElementAt
in class javax.swing.DefaultListModel
obj
- what the component is to be set toindex
- the specified indexjava.lang.ArrayIndexOutOfBoundsException
public java.lang.Object[] toArray()
toArray
in class javax.swing.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 state