This convenience class implements the Transferable and ClipboardOwner interfaces in order to make it very easy to transfer String values through the AWT data transfer mechanism. It is able to transfer String values using either the DataFlavor.stringFlavor or DataFlavor.plainTextFlavor data flavors.
To create a StringSelection object, simply pass the String you want to transfer to the StringSelection() constructor. You can then make the StringSelection available for transfer by passing it to the setContents() method of the Clipboard. You need never call the methods of StringSelection yourself.
public class StringSelection extends Object implements Transferable, ClipboardOwner { // Public Constructor public StringSelection(String data); // Public Instance Methods public synchronized Object getTransferData(DataFlavor flavor) public synchronized Object getTransferData'u'throws UnsupportedFlavorException, IOException; public synchronized Object getTransferData'u'// From Transferable public synchronized DataFlavor[] getTransferDataFlavors(); // From Transferable public boolean isDataFlavorSupported(DataFlavor flavor); // From Transferable public void lostOwnership(Clipboard clipboard, Transferable contents); // From ClipboardOwner }
This HTML Help has been published using the chm2web software. |