public class ClipboardContent extends HashMap<DataFormat,Object>
Clipboard
data. It can hold multiple data in
several data formats.AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
Constructor and Description |
---|
ClipboardContent() |
Modifier and Type | Method and Description |
---|---|
List<File> |
getFiles()
Gets the List of Files from the
ClipboardContent
which had previously been put. |
String |
getHtml()
Gets the HTML String from the
ClipboardContent
which had previously been put. |
Image |
getImage()
Gets the Image from the
ClipboardContent
which had previously been put. |
String |
getRtf()
Gets the RTF String from the
ClipboardContent
which had previously been put. |
String |
getString()
Gets the plain text String from the
ClipboardContent
which had previously been put. |
String |
getUrl()
Gets the URL String from the
ClipboardContent
which had previously been put. |
boolean |
hasFiles()
Gets whether a List of Files (
DataFormat.FILES )
has been put to this ClipboardContent . |
boolean |
hasHtml()
Gets whether an HTML String (
DataFormat.HTML )
has been put to this ClipboardContent . |
boolean |
hasImage()
Gets whether an Image (
DataFormat.IMAGE )
has been put to this ClipboardContent . |
boolean |
hasRtf()
Gets whether a RTF String (
DataFormat.RTF )
has been put to this ClipboardContent . |
boolean |
hasString()
Gets whether a plain text String (
DataFormat.PLAIN_TEXT )
has been put to this ClipboardContent . |
boolean |
hasUrl()
Gets whether a URL String (
DataFormat.URL )
has been put to this ClipboardContent . |
boolean |
putFiles(List<File> files)
Puts a List of Files into the
ClipboardContent . |
boolean |
putFilesByPath(List<String> filePaths)
Puts a List of Files into the
ClipboardContent , based
on the file path. |
boolean |
putHtml(String html)
Puts an HTML String into the
ClipboardContent . |
boolean |
putImage(Image i)
Puts an Image into the
ClipboardContent . |
boolean |
putRtf(String rtf)
Puts a RTF String into the
ClipboardContent . |
boolean |
putString(String s)
Puts a plain text String into the
ClipboardContent . |
boolean |
putUrl(String url)
Puts a URL String into the
ClipboardContent . |
clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
equals, hashCode, toString
public final boolean hasString()
DataFormat.PLAIN_TEXT
)
has been put to this ClipboardContent
.containsKey(DataFormat.PLAIN_TEXT)
returns true, false otherwisepublic final boolean putString(String s)
ClipboardContent
. This is
equivalent to invoking put(DataFormat.PLAIN_TEXT, s)
.
Setting this value to null effectively clears it
from the ClipboardContent
.s
- The string to place. This may be null.public final String getString()
ClipboardContent
which had previously been put. This is equivalent to invoking
get(DataFormat.PLAIN_TEXT)
. If no such entry exists,
null is returned.ClipboardContent
associated
with DataFormat.PLAIN_TEXT
, or null if there is not one.public final boolean hasUrl()
DataFormat.URL
)
has been put to this ClipboardContent
.containsKey(DataFormat.URL)
returns true, false otherwisepublic final boolean putUrl(String url)
ClipboardContent
. This is
equivalent to invoking put(DataFormat.URL, url)
.
Setting this value to null effectively clears it
from the ClipboardContent
.url
- The string to place. This may be null.public final String getUrl()
ClipboardContent
which had previously been put. This is equivalent to invoking
get(DataFormat.URL)
. If no such entry exists,
null is returned.ClipboardContent
associated
with DataFormat.URL
, or null if there is not one.public final boolean hasHtml()
DataFormat.HTML
)
has been put to this ClipboardContent
.containsKey(DataFormat.HTML)
returns true, false otherwisepublic final boolean putHtml(String html)
ClipboardContent
. This is
equivalent to invoking put(DataFormat.HTML, html)
.
Setting this value to null effectively clears it
from the ClipboardContent
.html
- The string to place. This may be null.public final String getHtml()
ClipboardContent
which had previously been put. This is equivalent to invoking
get(DataFormat.HTML)
. If no such entry exists,
null is returned.ClipboardContent
associated
with DataFormat.HTML
, or null if there is not one.public final boolean hasRtf()
DataFormat.RTF
)
has been put to this ClipboardContent
.containsKey(DataFormat.RTF)
returns true, false otherwisepublic final boolean putRtf(String rtf)
ClipboardContent
. This is
equivalent to invoking put(DataFormat.RTF, rtf)
.
Setting this value to null effectively clears it
from the ClipboardContent
.rtf
- The string to place. This may be null.public final String getRtf()
ClipboardContent
which had previously been put. This is equivalent to invoking
get(DataFormat.RTF)
. If no such entry exists,
null is returned.ClipboardContent
associated
with DataFormat.RTF
, or null if there is not one.public final boolean hasImage()
DataFormat.IMAGE
)
has been put to this ClipboardContent
.containsKey(DataFormat.IMAGE)
returns true, false otherwisepublic final boolean putImage(Image i)
ClipboardContent
. This is
equivalent to invoking put(DataFormat.IMAGE, i)
.
Setting this value to null effectively clears it
from the ClipboardContent
. When an image is placed
on the clipboard in this manner, an operating system dependent image
is loaded onto the clipboard (such as TIFF on Mac or DIB on Windows).i
- The image to place. This may be null.public final Image getImage()
ClipboardContent
which had previously been put. This is equivalent to invoking
get(DataFormat.IMAGE)
. If no such entry exists,
null is returned.ClipboardContent
associated
with DataFormat.IMAGE
, or null if there is not one.public final boolean hasFiles()
DataFormat.FILES
)
has been put to this ClipboardContent
.containsKey(DataFormat.FILES)
returns true, false otherwisepublic final boolean putFiles(List<File> files)
ClipboardContent
. This is
equivalent to invoking put(DataFormat.FILES, files)
.
Setting this value to null effectively clears it
from the ClipboardContent
.files
- The files to place. This may be null.public final boolean putFilesByPath(List<String> filePaths)
ClipboardContent
, based
on the file path. This is simply a convenience method which constructs
a List of Files and invokes the putFiles(java.util.List<java.io.File>)
method.filePaths
- The files to place. This may be null.public final List<File> getFiles()
ClipboardContent
which had previously been put. This is equivalent to invoking
get(DataFormat.FILES)
. If no such entry exists,
null is returned.ClipboardContent
associated
with DataFormat.FILES
, or null if there is not one.Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 2008, 2017, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.