java.awt.datatransfer

Class Clipboard

public class Clipboard extends Object

This class allows data to be transferred using a cut and paste type mechanism.
Field Summary
protected Transferablecontents
The data currently on this clipboard.
protected ClipboardOwnerowner
The owner of this clipboard.
Constructor Summary
Clipboard(String name)
Initializes a new instance of Clipboard with the specified name.
Method Summary
voidaddFlavorListener(FlavorListener listener)
DataFlavor[]getAvailableDataFlavors()
TransferablegetContents(Object requestor)
Returns the contents of the clipboard.
ObjectgetData(DataFlavor flavor)
FlavorListener[]getFlavorListeners()
StringgetName()
Returns the name of the clipboard.
booleanisDataFlavorAvailable(DataFlavor flavor)
voidremoveFlavorListener(FlavorListener listener)
voidsetContents(Transferable contents, ClipboardOwner owner)
Sets the content and owner of this clipboard.

Field Detail

contents

protected Transferable contents
The data currently on this clipboard. For use by subclasses. Also returned by the public method getContents().

owner

protected ClipboardOwner owner
The owner of this clipboard.

Constructor Detail

Clipboard

public Clipboard(String name)
Initializes a new instance of Clipboard with the specified name.

Parameters: name The clipboard name.

Method Detail

addFlavorListener

public void addFlavorListener(FlavorListener listener)

getAvailableDataFlavors

public DataFlavor[] getAvailableDataFlavors()

getContents

public Transferable getContents(Object requestor)
Returns the contents of the clipboard.

Parameters: requestor The object requesting the contents. This implementation ignores this parameter.

Throws: IllegalStateException If the clipboard is currently unavailable

getData

public Object getData(DataFlavor flavor)

getFlavorListeners

public FlavorListener[] getFlavorListeners()

getName

public String getName()
Returns the name of the clipboard.

isDataFlavorAvailable

public boolean isDataFlavorAvailable(DataFlavor flavor)

removeFlavorListener

public void removeFlavorListener(FlavorListener listener)

setContents

public void setContents(Transferable contents, ClipboardOwner owner)
Sets the content and owner of this clipboard. If the given owner is different from the current owner then lostOwnership() is called on the current owner with the old contents of the given clipboard.

Parameters: contents The new clipboard contents. owner The new clipboard owner

Throws: IllegalStateException If the clipboard is currently unavailable