StringSelectionNameStringSelection
DescriptionStringSelection is a "convenience" class that can be used for copy and paste operations on Unicode text strings. For example, you could place a string on the system's clipboard with the following code:
Clipboard c = Toolkit.getDefaultToolkit().getSystemClipboard(); StringSelection s = new StringSelection( "Be safe when you cut and paste."); c.setContents(s, s); Class Definition
public class java.awt.datatransfer.StringSelection extends java.lang.Object implements java.awt.datatransfer.ClipboardOwner, java.awt.datatransfer.Transferable { // Constructor public StringSelection(String data); // Instance Methods public synchronized Object getTransferData (DataFlavor flavor) throws UnsupportedFlavorException, IOException; public synchronized DataFlavor[] getTransferDataFlavors(); public boolean isDataFlavorSupported (DataFlavor flavor); public void lostOwnership (Clipboard clipboard, Transferable contents); } ConstructorsStringSelectionpublic StringSelection (String data)
Instance MethodsgetTransferDatapublic synchronized Object getTransferData (DataFlavor flavor) throws UnsupportedFlavorException, IOException
getTransferDataFlavorspublic synchronized DataFlavor[] getTransferDataFlavors()
isDataFlavorSupportedpublic boolean isDataFlavorSupported (DataFlavor flavor)
lostOwnershippublic void lostOwnership (Clipboard clipboard, Transferable contents)
See AlsoClipboard, ClipboardOwner, DataFlavor, String, Transferable |
|