Class HistoryModel

  • All Implemented Interfaces:
    Serializable, ListModel, MutableListModel

    public class HistoryModel
    extends DefaultListModel
    implements MutableListModel
    A history list. One history list can be used by several history text fields. Note that the list model implementation is incomplete; no events are fired when the history model changes.
    Version:
    $Id: HistoryModel.java 12504 2008-04-22 23:12:43Z ezust $
    Author:
    Slava Pestov
    See Also:
    Serialized Form
    • Constructor Detail

      • HistoryModel

        public HistoryModel​(String name)
        Creates a new history list. Calling this is normally not necessary.
    • Method Detail

      • addItem

        public void addItem​(String text)
        Adds an item to the end of this history list, trimming the list to the maximum number of items if necessary.
        Parameters:
        text - The item
      • getItem

        public String getItem​(int index)
        Returns an item from the history list.
        Parameters:
        index - The index
      • clear

        public void clear()
        Deprecated.
        Call removeAllElements() instead.
        Overrides:
        clear in class DefaultListModel
      • getName

        public String getName()
        Returns the name of this history list. This can be passed to the HistoryTextField constructor.
      • getModel

        public static HistoryModel getModel​(String name)
        Returns a named model. If the specified model does not already exist, it will be created.
        Parameters:
        name - The model name
      • loadHistory

        public static void loadHistory()
      • saveHistory

        public static void saveHistory()
      • setMax

        public static void setMax​(int max)