Place data of the specified type on the specified clipboard. More than one
type of data can be placed on the specified clipboard at the same time.
Setting the data clears any previous data from the specified
clipboard, regardless of type.
<p>NOTE: On some platforms, the data is immediately copied to the specified
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 clipboards value is either one of the clipboard constants defined in
class <code>DND</code>, or must be built by <em>bitwise OR</em>'ing together
(that is, using the <code>int</code> "|" operator) two or more
of those <code>DND</code> clipboard constants.</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
@param clipboards on which to set the data
@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 specified clipboard. More than one type of data can be placed on the specified clipboard at the same time. Setting the data clears any previous data from the specified clipboard, regardless of type.
<p>NOTE: On some platforms, the data is immediately copied to the specified 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 clipboards value is either one of the clipboard constants defined in class <code>DND</code>, or must be built by <em>bitwise OR</em>'ing together (that is, using the <code>int</code> "|" operator) two or more of those <code>DND</code> clipboard constants.</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, DND.CLIPBOARD); 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 @param clipboards on which to set the data
@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>
@see DND#CLIPBOARD @see DND#SELECTION_CLIPBOARD
@since 3.1