| java.lang.Object java.awt.datatransfer.StringSelection
StringSelection | public class StringSelection implements Transferable,ClipboardOwner(Code) | | A Transferable which implements the capability required to transfer a
String.
This Transferable properly supports DataFlavor.stringFlavor
and all equivalent flavors. Support for DataFlavor.plainTextFlavor
and all equivalent flavors is deprecated. No other
DataFlavors are supported.
See Also: java.awt.datatransfer.DataFlavor.stringFlavor See Also: java.awt.datatransfer.DataFlavor.plainTextFlavor |
Constructor Summary | |
public | StringSelection(String data) Creates a Transferable capable of transferring the specified String. |
StringSelection | public StringSelection(String data)(Code) | | Creates a Transferable capable of transferring the specified String.
|
getTransferData | public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException(Code) | | Returns the Transferable's data in the requested DataFlavor if
possible. If the desired flavor is DataFlavor.stringFlavor ,
or an equivalent flavor, the String representing the selection is
returned. If the desired flavor is DataFlavor.plainTextFlavor
, or an equivalent flavor, a Reader is returned. Note:
The behavior of this method for DataFlavor.plainTextFlavor
and equivalent DataFlavors is inconsistent with the definition of
DataFlavor.plainTextFlavor .
Parameters: flavor - the requested flavor for the data the data in the requested flavor, as outlined above. throws: UnsupportedFlavorException - if the requested data flavor isnot equivalent to either DataFlavor.stringFlavor or DataFlavor.plainTextFlavor . throws: IOException - if an IOException occurs while retrieving the data.By default, StringSelection never throws this exception, but asubclass may. throws: NullPointerException - if flavor is null See Also: java.io.Reader |
getTransferDataFlavors | public DataFlavor[] getTransferDataFlavors()(Code) | | Returns an array of flavors in which this Transferable can provide
the data. DataFlavor.stringFlavor is properly supported.
Support for DataFlavor.plainTextFlavor is
deprecated.
an array of length two, whose elements are DataFlavor.stringFlavor and DataFlavor.plainTextFlavor . |
isDataFlavorSupported | public boolean isDataFlavorSupported(DataFlavor flavor)(Code) | | Returns whether the requested flavor is supported by this Transferable.
Parameters: flavor - the requested flavor for the data true if flavor is equal toDataFlavor.stringFlavor orDataFlavor.plainTextFlavor ; false if flavor is not one of the above flavors throws: NullPointerException - if flavor is null |
|
|