Enum Class ClipboardMonitor

java.lang.Object
java.lang.Enum<ClipboardMonitor>
com.luna.common.swing.ClipboardMonitor
All Implemented Interfaces:
ClipboardOwner, Closeable, Serializable, AutoCloseable, Comparable<ClipboardMonitor>, java.lang.constant.Constable, Runnable

public enum ClipboardMonitor extends Enum<ClipboardMonitor> implements ClipboardOwner, Runnable, Closeable
剪贴板监听
Since:
4.5.6
Author:
looly
  • Enum Constant Details

  • Field Details

    • DEFAULT_TRY_COUNT

      public static final int DEFAULT_TRY_COUNT
      默认重试此时:10
      See Also:
    • DEFAULT_DELAY

      public static final long DEFAULT_DELAY
      默认重试等待:100
      See Also:
  • Method Details

    • values

      public static ClipboardMonitor[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static ClipboardMonitor valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • setTryCount

      public ClipboardMonitor setTryCount(int tryCount)
      设置重试次数
      Parameters:
      tryCount - 重试次数
      Returns:
      this
    • setDelay

      public ClipboardMonitor setDelay(long delay)
      设置重试等待
      Parameters:
      delay - 重试等待
      Returns:
      this
    • addListener

      public ClipboardMonitor addListener(ClipboardListener listener)
      设置 监听事件处理
      Parameters:
      listener - 监听事件处理
      Returns:
      this
    • removeListener

      public ClipboardMonitor removeListener(ClipboardListener listener)
      去除指定监听
      Parameters:
      listener - 监听
      Returns:
      this
    • clearListener

      public ClipboardMonitor clearListener()
      清空监听
      Returns:
      this
    • lostOwnership

      public void lostOwnership(Clipboard clipboard, Transferable contents)
      Specified by:
      lostOwnership in interface ClipboardOwner
    • run

      public void run()
      Specified by:
      run in interface Runnable
    • listen

      public void listen(boolean sync)
      开始监听
      Parameters:
      sync - 是否阻塞
    • close

      public void close()
      关闭(停止)监听
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable