Skip to content

Merge pull request #15 from GistIcon/master#21

Merged
usernamealreadyis merged 1 commit into
GistIcon:masterfrom
xccvv:master
Jun 15, 2016
Merged

Merge pull request #15 from GistIcon/master#21
usernamealreadyis merged 1 commit into
GistIcon:masterfrom
xccvv:master

Conversation

@usernamealreadyis

Copy link
Copy Markdown

Method Summary

public class Clipboard
extends java.lang.Object

Represents an operating system clipboard, on which data may be placed during, for example, cut, copy, and paste operations.

To access the general system clipboard, use the following code:

 Clipboard clipboard = Clipboard.getSystemClipboard();

There is only ever one instance of the system clipboard in the application, so it is perfectly acceptable to stash a reference to it somewhere handy if you so choose.

The Clipboard operates on the concept of having a single conceptual item on the clipboard at any one time -- though it may be placed on the clipboard in different formats. For example, the user might select text in an HTML editor and press the ctrl+c or cmd+c to copy it. In this case, the same text might be available on the clipboard both as HTML and as plain text. There are two copies of the data on the clipboard, but they both represent the same data.

Content is specified on the Clipboard by using the setContent(java.util.Map) method. First, construct a ClipboardContent object, then invoke setContent. Every time setContent is called, any previous data on the clipboard is cleared and replaced with this new content.

 final Clipboard clipboard = Clipboard.getSystemClipboard();
 final ClipboardContent content = new ClipboardContent();
 content.putString("Some text");
 content.putHtml("<b>Some</b> text");
 clipboard.setContent(content);

@GistIcon GistIcon locked and limited conversation to collaborators Jun 15, 2016
@usernamealreadyis usernamealreadyis merged commit c9dba10 into GistIcon:master Jun 15, 2016
@usernamealreadyis usernamealreadyis added this to the Bug 1130559 milestone Jun 16, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants