The java.awt.datatransfer.StringSelection class

The java.awt.datatransfer.StringSelection class is the only concrete implementation of the java.awt.datatransfer.Transferable interface and the java.awt.datatransfer.ClipboardOwner interface in Java 1.1. It lets you transfer a string in plain text format.

It has the four methods it must implement to support its interfaces:

 public abstract boolean isDataFlavorSupported(DataFlavor flavor)
 public abstract DataFlavor[] getTransferDataFlavors()
 public abstract Object getTransferData(DataFlavor flavor) 
  throws UnsupportedFlavorException, IOException
 public void lostOwnership(Clipboard clipboard, Transferable contents)
It also has a constructor you use to create a new StringSelection object:

 public StringSelection(String data)

Previous | Next | Top
Last Modified April 21, 1997
elharo@metalab.unc.edu