public class TooltipDataItemListModel
extends java.lang.Object
implements javax.swing.ListModel
TooltipDataItemListModel
is a basic implementation of
an immutable ListModel which just takes an array of TooltipDataItem
objects (or its subclasses) and can be used as the ListModel for a
JList. This class makes a copy of the array (but not the objects)
passed to it in case the array is modified. Constructor and Description |
---|
TooltipDataItemListModel(TooltipDataItem[] data)
Constructs a new
TooltipDataItemListModel using the data
elements specified. |
Modifier and Type | Method and Description |
---|---|
void |
addListDataListener(javax.swing.event.ListDataListener listener)
Add a listener to the list that's notified each time a change
to the data model occurs.
|
java.lang.Object |
getElementAt(int index)
Returns the value at the specified index.
|
int |
getSize()
Returns the length of the list.
|
void |
removeListDataListener(javax.swing.event.ListDataListener listener)
Remove a listener from the list that's notified each time a
change to the data model occurs.
|
public TooltipDataItemListModel(TooltipDataItem[] data)
TooltipDataItemListModel
using the data
elements specified. A copy of the array will be made in
case the original array is changed. This will by default,
sort the data passed in through the list.data
- the array of TooltipDataItem's to make up the modelpublic int getSize()
getSize
in interface javax.swing.ListModel
public java.lang.Object getElementAt(int index)
getElementAt
in interface javax.swing.ListModel
index
- the index of the value to getpublic void addListDataListener(javax.swing.event.ListDataListener listener)
addListDataListener
in interface javax.swing.ListModel
listener
- the ListDataListenerpublic void removeListDataListener(javax.swing.event.ListDataListener listener)
removeListDataListener
in interface javax.swing.ListModel
listener
- the ListDataListener