wonderly.jeaprs.swing
Class CircularListModel
java.lang.Object
|
+--javax.swing.AbstractListModel
|
+--wonderly.jeaprs.swing.VectorListModel
|
+--wonderly.jeaprs.swing.CircularListModel
- All Implemented Interfaces:
- javax.swing.ListModel, java.io.Serializable
- public class CircularListModel
- extends VectorListModel
This class provides a circular list model for the JList class which allows
for fixed sized lists of fast changing data to be managed effectively.
When a list should just display the last-N elements of data added, this
model is optimized to do that so that you don't have to shuffel every element
in a large vector or array down by one index to delete the first element and
then add the new element at the end.
- Version:
- 1.0
- Author:
- Gregg Wonderly -
The information contained in this document is Copyright 2001-2003, Gregg Wonderly,
all rights reserved.
- See Also:
- Serialized Form
Fields inherited from class javax.swing.AbstractListModel |
listenerList |
Methods inherited from class wonderly.jeaprs.swing.VectorListModel |
add, capacity, clear, contains, copyInto, elements, ensureCapacity, firstElement, get, getContents, indexOf, indexOf, insertElementAt, isEmpty, lastElement, lastIndexOf, lastIndexOf, remove, removeElement, removeElementAt, removeRange, set, setContents, setSize, toArray, trimToSize |
Methods inherited from class javax.swing.AbstractListModel |
addListDataListener, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, getListDataListeners, getListeners, removeListDataListener |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
CircularListModel
public CircularListModel(int max)
toString
public java.lang.String toString()
- Overrides:
toString
in class VectorListModel
removeAllElements
public void removeAllElements()
- Overrides:
removeAllElements
in class VectorListModel
size
public int size()
- Overrides:
size
in class VectorListModel
elementAt
public java.lang.Object elementAt(int i)
- Overrides:
elementAt
in class VectorListModel
setElementAt
public void setElementAt(java.lang.Object obj,
int i)
- Overrides:
setElementAt
in class VectorListModel
setMaxSize
public void setMaxSize(int sz)
getSize
public int getSize()
- Specified by:
getSize
in interface javax.swing.ListModel
- Overrides:
getSize
in class VectorListModel
getElementAt
public java.lang.Object getElementAt(int idx)
- Specified by:
getElementAt
in interface javax.swing.ListModel
- Overrides:
getElementAt
in class VectorListModel
addElement
public void addElement(java.lang.Object obj)
- Overrides:
addElement
in class VectorListModel