javax.swing.ListModel
, MutableListModel
public class HistoryModel extends javax.swing.DefaultListModel implements MutableListModel
Constructor | Description |
---|---|
HistoryModel(java.lang.String name) |
Creates a new history list.
|
Modifier and Type | Method | Description |
---|---|---|
void |
addItem(java.lang.String text) |
Adds an item to the end of this history list, trimming the list
to the maximum number of items if necessary.
|
static int |
getDefaultMax() |
Gets the default size of all HistoryModels.
|
static int |
getDefaultMaxSize() |
Gets the default maximum size (in characters) for all history models.
|
java.lang.String |
getItem(int index) |
Returns an item from the history list.
|
int |
getMax() |
|
int |
getMaxSize() |
|
static HistoryModel |
getModel(java.lang.String name) |
Returns a named model.
|
java.lang.String |
getName() |
Returns the name of this history list.
|
void |
insertElementAt(java.lang.Object obj,
int index) |
|
static void |
loadHistory() |
|
void |
removeAllElements() |
|
boolean |
removeElement(java.lang.Object obj) |
|
static void |
saveHistory() |
|
static void |
setDefaultMax(int max) |
Sets the default size of all HistoryModels.
|
static void |
setDefaultMaxSize(int newMax) |
Sets the default max size (in characters) for all history models.
|
void |
setMax(int max) |
sets the maximum size of this history
|
void |
setMaxSize(int max) |
Sets the maximum size (in characters) for this history model
|
static void |
setSaver(HistoryModelSaver saver) |
addListDataListener, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, getListDataListeners, getListeners, removeListDataListener
add, addElement, capacity, clear, contains, copyInto, elementAt, elements, ensureCapacity, firstElement, get, getElementAt, getSize, indexOf, indexOf, isEmpty, lastElement, lastIndexOf, lastIndexOf, remove, removeElementAt, removeRange, set, setElementAt, setSize, size, toArray, toString, trimToSize
public HistoryModel(java.lang.String name)
public void addItem(java.lang.String text)
text
- The itempublic void insertElementAt(java.lang.Object obj, int index)
insertElementAt
in interface MutableListModel
insertElementAt
in class javax.swing.DefaultListModel
public java.lang.String getItem(int index)
index
- The indexpublic boolean removeElement(java.lang.Object obj)
removeElement
in interface MutableListModel
removeElement
in class javax.swing.DefaultListModel
public void removeAllElements()
removeAllElements
in class javax.swing.DefaultListModel
public java.lang.String getName()
public static HistoryModel getModel(java.lang.String name)
name
- The model namepublic static void loadHistory()
public static void saveHistory()
public void setMax(int max)
max
- the new maximum size of this history of -1 to restore defaultpublic int getMax()
public void setMaxSize(int max)
max
- the new maximum size for the history model, or -1 to restore the defaultpublic int getMaxSize()
public static void setDefaultMax(int max)
public static int getDefaultMax()
public static void setDefaultMaxSize(int newMax)
setMaxSize(int)
instead.public static int getDefaultMaxSize()
public static void setSaver(HistoryModelSaver saver)