java.awt.datatransfer
Class Clipboard

java.lang.Object
  extended by java.awt.datatransfer.Clipboard

public class Clipboard
extends Object

This class allows data to be transferred using a cut and paste type mechanism.


Field Summary
protected  Transferable contents
          The data currently on this clipboard.
protected  ClipboardOwner owner
          The owner of this clipboard.
 
Constructor Summary
Clipboard(String name)
          Initializes a new instance of Clipboard with the specified name.
 
Method Summary
 void addFlavorListener(FlavorListener listener)
           
 DataFlavor[] getAvailableDataFlavors()
           
 Transferable getContents(Object requestor)
          Returns the contents of the clipboard.
 Object getData(DataFlavor flavor)
           
 FlavorListener[] getFlavorListeners()
           
 String getName()
          Returns the name of the clipboard.
 boolean isDataFlavorAvailable(DataFlavor flavor)
           
 void removeFlavorListener(FlavorListener listener)
           
 void setContents(Transferable contents, ClipboardOwner owner)
          Sets the content and owner of this clipboard.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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

getName

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


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

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

getAvailableDataFlavors

public DataFlavor[] getAvailableDataFlavors()

isDataFlavorAvailable

public boolean isDataFlavorAvailable(DataFlavor flavor)

getData

public Object getData(DataFlavor flavor)
               throws UnsupportedFlavorException,
                      IOException
Throws:
UnsupportedFlavorException
IOException

addFlavorListener

public void addFlavorListener(FlavorListener listener)

removeFlavorListener

public void removeFlavorListener(FlavorListener listener)

getFlavorListeners

public FlavorListener[] getFlavorListeners()