java.awt.datatransfer
public class StringSelection extends Object implements Transferable, ClipboardOwner
Constructor and Description |
---|
StringSelection(String data)
Transfer the specfied string as text.
|
Modifier and Type | Method and Description |
---|---|
Object |
getTransferData(DataFlavor flavor)
This method returns the data in the requested format.
|
DataFlavor[] |
getTransferDataFlavors()
Returns a list of supported data flavors.
|
boolean |
isDataFlavorSupported(DataFlavor flavor)
Tests whether or not the specified data flavor is supported.
|
void |
lostOwnership(Clipboard clipboard,
Transferable contents)
Called when ownership of the clipboard object is lost.
|
public StringSelection(String data)
data
- the data for the string selectionpublic DataFlavor[] getTransferDataFlavors()
getTransferDataFlavors
in interface Transferable
public boolean isDataFlavorSupported(DataFlavor flavor)
isDataFlavorSupported
in interface Transferable
flavor
- The data flavor to test.true
if the data flavor is supported,
false
otherwise.public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException
getTransferData
in interface Transferable
flavor
- The desired data flavor.UnsupportedFlavorException
- If the specified flavor is not
supported.IOException
- If any other error occurs.DataFlavor.getRepresentationClass()
public void lostOwnership(Clipboard clipboard, Transferable contents)
lostOwnership
in interface ClipboardOwner
clipboard
- The affected clipboard.contents
- The clipboard contents.