/** * Sets the maximum number of clipboard values remembered. * * @param maxSize The maximum number of clipboard values to remember. * @throws IllegalArgumentException If <code>maxSize</code> is not greater * than zero. * @see #getMaxSize() */ public void setMaxSize(int maxSize) { if (maxSize<=0) { throw new IllegalArgumentException("Maximum size must be >= 0"); } this.maxSize = maxSize; trim(); }
/** * Adds an entry to the clipboard history. * * @param str The text to add. * @see #getHistory() */ public void add(String str) { int size = history.size(); if (size==0) { history.add(str); } else { int index = history.indexOf(str); if (index!=size-1) { if (index>-1) { history.remove(index); } history.add(str); } trim(); } }
/** * Sets the maximum number of clipboard values remembered. * * @param maxSize The maximum number of clipboard values to remember. * @throws IllegalArgumentException If <code>maxSize</code> is not greater * than zero. * @see #getMaxSize() */ public void setMaxSize(int maxSize) { if (maxSize<=0) { throw new IllegalArgumentException("Maximum size must be >= 0"); } this.maxSize = maxSize; trim(); }
/** * Adds an entry to the clipboard history. * * @param str The text to add. * @see #getHistory() */ public void add(String str) { int size = history.size(); if (size==0) { history.add(str); } else { int index = history.indexOf(str); if (index!=size-1) { if (index>-1) { history.remove(index); } history.add(str); } trim(); } }