public void setMaxHistory(int size) {
        maxHistory = size;

        int current = history.size();
        if (current > size) {
            history.subList(size, current).clear();

            shownHistory = history;
            fireContentsChanged(this, maxHistory, current);
        }
    }
public void setMaxHistory(int size)