Clipboard.getContents

Retrieve the data of the specified type currently available on the system clipboard. Refer to the specific subclass of <code>Transfer</code> to determine the type of object returned.

<p>The following snippet shows text and RTF text being retrieved from the clipboard:</p>

<code><pre> Clipboard clipboard = new Clipboard(display); TextTransfer textTransfer = TextTransfer.getInstance(); String textData = (String)clipboard.getContents(textTransfer); if (textData !is null) System.out.println("Text is "+textData); RTFTransfer rtfTransfer = RTFTransfer.getInstance(); String rtfData = (String)clipboard.getContents(rtfTransfer); if (rtfData !is null) System.out.println("RTF Text is "+rtfData); clipboard.dispose(); </code></pre>

@param transfer the transfer agent for the type of data being requested @return the data obtained from the clipboard or null if no data of this type is available

@exception SWTException <ul> <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> </ul> @exception IllegalArgumentException <ul> <li>ERROR_NULL_ARGUMENT - if transfer is null</li> </ul>

@see Transfer

  1. Object getContents(Transfer transfer)
    class Clipboard
    Object
    getContents
  2. Object getContents(Transfer transfer, int clipboards)

Meta