java.lang.Object
javafx.scene.input.DataFormat
Data format identifier used as means
of identifying the data stored on a clipboard/dragboard.
- Since:
- JavaFX 2.0
-
Field Summary
Modifier and TypeFieldDescriptionstatic final DataFormat
Represents a List of Files.static final DataFormat
Represents an HTML formatted string.static final DataFormat
A special platform specific image type, such as is commonly used on the clipboard and interoperates widely with other applications.static final DataFormat
Represents a plain text string.static final DataFormat
Represents an RTF formatted stringstatic final DataFormat
Represents a URL, encoded as a String -
Constructor Summary
ConstructorDescriptionDataFormat
(String... ids) Create a new DataFormat, specifying the set of ids that are associated with this data format. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Indicates whether some other object is "equal to" this one.Gets the unmodifiable set of identifiers for this DataFormat.int
hashCode()
Returns a hash code for thisDataFormat
object.static DataFormat
lookupMimeType
(String mimeType) Looks for the DataFormat which has been previously created with the given mime type as one of its ids.toString()
Returns a string representation of thisDataFormat
object.
-
Field Details
-
PLAIN_TEXT
Represents a plain text string. -
HTML
Represents an HTML formatted string. -
RTF
Represents an RTF formatted string -
URL
Represents a URL, encoded as a String -
IMAGE
A special platform specific image type, such as is commonly used on the clipboard and interoperates widely with other applications. For example, on Mac this might ultimately be a TIFF while on Windows it might be a DIB (device independent bitmap). -
FILES
Represents a List of Files.
-
-
Constructor Details
-
DataFormat
Create a new DataFormat, specifying the set of ids that are associated with this data format. Typically the ids are one or more mime types. For each id, any data associated with this DataFormat will be registered on the clipboard. For example, suppose I had the following:
With the above code, if I were to look on the clipboard, I'd find the String "Hello" listed both for "text/foo" and "text/bar" on the clipboard.DataFormat fmt = new DataFormat("text/foo", "text/bar"); Clipboard clipboard = Clipboard.getSystemClipboard(); ClipboardContent content = new ClipboardContent(); content.put(fmt, "Hello"); clipboard.setContent(content);
Note that the ids may be subject to platform restrictions in some cases. For instance, Swing requires a mime type so if an
id
is not of the "type/subtype" format it won't be possible to drag data of this type from/toJFXPanel
.- Parameters:
ids
- The set of ids used to represent this DataFormat on the clipboard.- Throws:
IllegalArgumentException
- if one of the given mime types is already assigned to another DataFormat.
-
-
Method Details
-
getIdentifiers
Gets the unmodifiable set of identifiers for this DataFormat.- Returns:
- an unmodifiable set that is never null.
-
toString
Returns a string representation of thisDataFormat
object. -
hashCode
public int hashCode()Returns a hash code for thisDataFormat
object. -
equals
Indicates whether some other object is "equal to" this one. -
lookupMimeType
Looks for the DataFormat which has been previously created with the given mime type as one of its ids.- Parameters:
mimeType
- If null or the empty string, then null is returned.- Returns:
- The matching DataFormat
-