Clipboard

class Clipboard(val delegate: Clipboard) extends SFXDelegate[Clipboard]

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

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:

val clipboard = Clipboard.systemClipboard

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.

Example use:

 val clipboard = Clipboard.systemClipboard
 val content = new ClipboardContent()
 content.putString("Some text")
 content.putHtml("<b>Some</b> text")
 clipboard.content = content

Alternative use:

  Clipboard.systemClipboard.content = ClipboardContent(
    DataFormat.PlainText -> "Some text",
    DataFormat.Html -> "<b>Some</b> text"
  )

Caution when putting files into the clipboard. The recommended method is:

 val content = new ClipboardContent()
 content.putString("Some text")

Wraps a JavaFX http://docs.oracle.com/javase/8/javafx/api/javafx/scene/input/Clipboard.html Clipboard.

Value Params
delegate

A JavaFX Clipboard to be wrapped. Its default value is a new JavaFX Clipboard.

Constructor

Creates a new Clipboard from a JavaFX one.

Companion
object
trait SFXDelegate[Clipboard]
class Object
trait Matchable
class Any
class Dragboard

Value members

Concrete methods

def clear(): Unit

Clears the clipboard of any and all content.

Clears the clipboard of any and all content.

def content(dataFormat: DataFormat): AnyRef

Returns the content stored in this clipboard of the given type, or null if there is no content with this type.

Returns the content stored in this clipboard of the given type, or null if there is no content with this type.

Return a copy of the clipboard content.

Return a copy of the clipboard content.

def contentTypes: Set[DataFormat]

Gets the set of DataFormat types on this Clipboard instance which have associated data registered on the clipboard.

Gets the set of DataFormat types on this Clipboard instance which have associated data registered on the clipboard.

def content_=(content: ClipboardContent): Unit

Puts content onto the clipboard.

Puts content onto the clipboard.

This call will always result in clearing all previous content from the clipboard, and replacing it with whatever content is specified in the supplied ClipboardContent map.

Throws
java.lang.NullPointerException
  • if null data reference is passed for any format
def files: Seq[File]

Gets the list of files from the clipboard which had previously been registered.

Gets the list of files from the clipboard which had previously been registered.

def hasContent(dataFormat: DataFormat): Boolean

Tests whether there is any content on this clipboard of the given DataFormat type.

Tests whether there is any content on this clipboard of the given DataFormat type.

def hasFiles: Boolean

Gets whether an list of files (DataFormat.Files) has been registered on this Clipboard.

Gets whether an list of files (DataFormat.Files) has been registered on this Clipboard.

def hasHtml: Boolean

Gets whether an HTML text String (DataFormat.Html) has been registered on this Clipboard.

Gets whether an HTML text String (DataFormat.Html) has been registered on this Clipboard.

def hasImage: Boolean

Gets whether an Image (DataFormat.Image) has been registered on this Clipboard.

Gets whether an Image (DataFormat.Image) has been registered on this Clipboard.

def hasRtf: Boolean

Gets whether an RTF String (DataFormat.Rtf) has been registered on this Clipboard.

Gets whether an RTF String (DataFormat.Rtf) has been registered on this Clipboard.

def hasString: Boolean

Gets whether a plain text String (DataFormat.PlainText) has been registered on this Clipboard.

Gets whether a plain text String (DataFormat.PlainText) has been registered on this Clipboard.

def hasUrl: Boolean

Gets whether a url String (DataFormat.Url) has been registered on this Clipboard.

Gets whether a url String (DataFormat.Url) has been registered on this Clipboard.

def html: String

Gets the HTML text String from the clipboard which had previously been registered.

Gets the HTML text String from the clipboard which had previously been registered.

def image: Image

Gets the Image from the clipboard which had previously been registered.

Gets the Image from the clipboard which had previously been registered.

def rtf: String

Gets the RTF text String from the clipboard which had previously been registered.

Gets the RTF text String from the clipboard which had previously been registered.

def string: String

Gets the plain text String from the clipboard which had previously been registered.

Gets the plain text String from the clipboard which had previously been registered.

def url: String

Gets the URL String from the clipboard which had previously been registered.

Gets the URL String from the clipboard which had previously been registered.

Inherited methods

override def equals(ref: Any): Boolean

Verifies if a object is equals to this delegate.

Verifies if a object is equals to this delegate.

Value Params
ref

Object to be compared.

Returns

if the other object is equals to this delegate or not.

Definition Classes
Inherited from
SFXDelegate
override def hashCode: Int
Returns

The delegate hashcode

Definition Classes
Inherited from
SFXDelegate
override def toString: String
Returns

Returns the original delegate's toString() adding a [SFX] prefix.

Definition Classes
Inherited from
SFXDelegate

Concrete fields

override val delegate: Clipboard