我有这段代码可以查看剪贴板:
import java.awt._
import java.awt.datatransfer.{StringSelection, DataFlavor}
object Application extends App {
val c = Toolkit.getDefaultToolkit.getSystemClipboard
val selection = new StringSelection("123theStringaaaaaaa")
c.setContents(selection, selection)
println(c.getData(DataFlavor.stringFlavor))
}
有没有办法订阅更改剪贴板的事件(新的东西被复制到剪贴板)?