Class ClipboardHistory

    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private ClipboardHistory()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(java.lang.String str)
      Adds an entry to the clipboard history.
      static ClipboardHistory get()
      Returns the singleton instance of this class, lazily creating it if necessary.
      java.util.List<java.lang.String> getHistory()
      Returns the clipboard history, in most-recently-used order.
      int getMaxSize()
      Returns the maximum number of clipboard values remembered.
      void setMaxSize​(int maxSize)
      Sets the maximum number of clipboard values remembered.
      private void trim()
      Ensures the remembered set of strings is not larger than the maximum allowed size.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • history

        private java.util.List<java.lang.String> history
      • maxSize

        private int maxSize
    • Constructor Detail

      • ClipboardHistory

        private ClipboardHistory()
    • Method Detail

      • add

        public void add​(java.lang.String str)
        Adds an entry to the clipboard history.
        Parameters:
        str - The text to add.
        See Also:
        getHistory()
      • get

        public static ClipboardHistory get()
        Returns the singleton instance of this class, lazily creating it if necessary.

        This method should only be called on the EDT.

        Returns:
        The singleton instance of this class.
      • getHistory

        public java.util.List<java.lang.String> getHistory()
        Returns the clipboard history, in most-recently-used order.
        Returns:
        The clipboard history.
      • getMaxSize

        public int getMaxSize()
        Returns the maximum number of clipboard values remembered.
        Returns:
        The maximum number of clipboard values remembered.
        See Also:
        setMaxSize(int)
      • setMaxSize

        public void setMaxSize​(int maxSize)
        Sets the maximum number of clipboard values remembered.
        Parameters:
        maxSize - The maximum number of clipboard values to remember.
        Throws:
        java.lang.IllegalArgumentException - If maxSize is not greater than zero.
        See Also:
        getMaxSize()
      • trim

        private void trim()
        Ensures the remembered set of strings is not larger than the maximum allowed size.