public synchronized void setContents (Transferable contents, ClipboardOwner owner)

Sets the current contents of the clipboard to the specified transferable object and registers the specified clipboard owner as the owner of the new contents.

If there is an existing owner different from the argument owner, that owner is notified that it no longer holds ownership of the clipboard contents via an invocation of ClipboardOwner.lostOwnership() on that owner. An implementation of setContents() is free not to invoke lostOwnership() directly from this method. For example, lostOwnership() may be invoked later on a different thread. The same applies to FlavorListeners registered on this clipboard.

The method throws IllegalStateException if the clipboard is currently unavailable. For example, on some platforms, the system clipboard is unavailable while it is accessed by another application.

Parameters:
contents    the transferable object representing the clipboard content
owner    the object which owns the clipboard content

Exceptions:
IllegalStateException    if the clipboard is currently unavailable

See also:
java.awt.Toolkit.getSystemClipboard