Place data of the specified type on the system clipboard. More than one type
of data can be placed on the system clipboard at the same time. Setting the
data clears any previous data from the system clipboard, regardless of type.
<p>NOTE: On some platforms, the data is immediately copied to the system
clipboard but on other platforms it is provided upon request. As a result,
if the application modifies the data object it has set on the clipboard, that
modification may or may not be available when the data is subsequently
requested.</p>
<p>The following snippet shows text and RTF text being set on the copy/paste
clipboard:
</p>
@param data the data to be set in the clipboard
@param dataTypes the transfer agents that will convert the data to its
platform specific format; each entry in the data array must have a
corresponding dataType
@exception IllegalArgumentException <ul>
<li>ERROR_INVALID_ARGUMENT - if data is null or datatypes is null
or the length of data is not the same as the length of dataTypes</li>
</ul>
@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 SWTError <ul>
<li>ERROR_CANNOT_SET_CLIPBOARD - if the clipboard is locked or otherwise unavailable</li>
</ul>
<p>NOTE: ERROR_CANNOT_SET_CLIPBOARD should be an SWTException, since it is a
recoverable error, but can not be changed due to backward compatibility.</p>
Place data of the specified type on the system clipboard. More than one type of data can be placed on the system clipboard at the same time. Setting the data clears any previous data from the system clipboard, regardless of type.
<p>NOTE: On some platforms, the data is immediately copied to the system clipboard but on other platforms it is provided upon request. As a result, if the application modifies the data object it has set on the clipboard, that modification may or may not be available when the data is subsequently requested.</p>
<p>The following snippet shows text and RTF text being set on the copy/paste clipboard: </p>
<code><pre> Clipboard clipboard = new Clipboard(display); String textData = "Hello World"; String rtfData = "{\\rtf1\\b\\i Hello World}"; TextTransfer textTransfer = TextTransfer.getInstance(); RTFTransfer rtfTransfer = RTFTransfer.getInstance(); Transfer[] transfers = new Transfer[]{textTransfer, rtfTransfer}; Object[] data = new Object[]{textData, rtfData}; clipboard.setContents(data, transfers); clipboard.dispose(); </code></pre>
@param data the data to be set in the clipboard @param dataTypes the transfer agents that will convert the data to its platform specific format; each entry in the data array must have a corresponding dataType
@exception IllegalArgumentException <ul> <li>ERROR_INVALID_ARGUMENT - if data is null or datatypes is null or the length of data is not the same as the length of dataTypes</li> </ul> @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 SWTError <ul> <li>ERROR_CANNOT_SET_CLIPBOARD - if the clipboard is locked or otherwise unavailable</li> </ul>
<p>NOTE: ERROR_CANNOT_SET_CLIPBOARD should be an SWTException, since it is a recoverable error, but can not be changed due to backward compatibility.</p>