java.lang.Object | |
↳ | java.awt.datatransfer.Clipboard |
Known Direct Subclasses |
A class that implements a mechanism to transfer data using cut/copy/paste operations.
FlavorListener
s may be registered on an instance of the
Clipboard class to be notified about changes to the set of
DataFlavor
s available on this clipboard (see
addFlavorListener(FlavorListener)
).
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
contents | |||||||||||
owner |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates a clipboard object.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Registers the specified
FlavorListener to receive
FlavorEvent s from this clipboard. | |||||||||||
Returns an array of
DataFlavor s in which the current
contents of this clipboard can be provided. | |||||||||||
Returns a transferable object representing the current contents
of the clipboard.
| |||||||||||
Returns an object representing the current contents of this clipboard
in the specified
DataFlavor . | |||||||||||
Returns an array of all the
FlavorListener s currently
registered on this Clipboard . | |||||||||||
Returns the name of this clipboard object.
| |||||||||||
Returns whether or not the current contents of this clipboard can be
provided in the specified
DataFlavor . | |||||||||||
Removes the specified
FlavorListener so that it no longer
receives FlavorEvent s from this Clipboard . | |||||||||||
Sets the current contents of the clipboard to the specified
transferable object and registers the specified clipboard owner
as the owner of the new contents.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Registers the specified FlavorListener
to receive
FlavorEvent
s from this clipboard.
If listener
is null
, no exception
is thrown and no action is performed.
listener | the listener to be added |
---|
Returns an array of DataFlavor
s in which the current
contents of this clipboard can be provided. If there are no
DataFlavor
s available, this method returns a zero-length
array.
DataFlavor
s in which the current
contents of this clipboard can be providedIllegalStateException | if this clipboard is currently unavailable |
---|
Returns a transferable object representing the current contents
of the clipboard. If the clipboard currently has no contents,
it returns null
. The parameter Object requestor is
not currently used. The method throws
IllegalStateException
if the clipboard is currently
unavailable. For example, on some platforms, the system clipboard is
unavailable while it is accessed by another application.
requestor | the object requesting the clip data (not used) |
---|
IllegalStateException | if the clipboard is currently unavailable |
---|
Returns an object representing the current contents of this clipboard
in the specified DataFlavor
.
The class of the object returned is defined by the representation
class of flavor
.
flavor | the requested DataFlavor for the contents |
---|
DataFlavor
NullPointerException | if flavor is null |
---|---|
IllegalStateException | if this clipboard is currently unavailable |
UnsupportedFlavorException | if the requested DataFlavor
is not available |
IOException | if the data in the requested DataFlavor
can not be retrieved |
Returns an array of all the FlavorListener
s currently
registered on this Clipboard
.
FlavorListener
s or an empty
array if no listeners are currently registeredReturns whether or not the current contents of this clipboard can be
provided in the specified DataFlavor
.
flavor | the requested DataFlavor for the contents |
---|
true
if the current contents of this clipboard
can be provided in the specified DataFlavor
;
false
otherwiseNullPointerException | if flavor is null |
---|---|
IllegalStateException | if this clipboard is currently unavailable |
Removes the specified FlavorListener
so that it no longer
receives FlavorEvent
s from this Clipboard
.
This method performs no function, nor does it throw an exception, if
the listener specified by the argument was not previously added to this
Clipboard
.
If listener
is null
, no exception
is thrown and no action is performed.
listener | the listener to be removed |
---|
Sets the current contents of the clipboard to the specified transferable object and registers the specified clipboard owner as the owner of the new contents.
If there is an existing owner different from the argument
owner
, that owner is notified that it no longer
holds ownership of the clipboard contents via an invocation
of ClipboardOwner.lostOwnership()
on that owner.
An implementation of setContents()
is free not
to invoke lostOwnership()
directly from this method.
For example, lostOwnership()
may be invoked later on
a different thread. The same applies to FlavorListener
s
registered on this clipboard.
The method throws IllegalStateException
if the clipboard
is currently unavailable. For example, on some platforms, the system
clipboard is unavailable while it is accessed by another application.
contents | the transferable object representing the clipboard content |
---|---|
owner | the object which owns the clipboard content |
IllegalStateException | if the clipboard is currently unavailable |
---|