JavaTM 2 Platform
Standard Edition

java.awt.datatransfer
Class StringSelection

java.lang.Object
  |
  +--java.awt.datatransfer.StringSelection

public class StringSelection
extends Object
implements Transferable, ClipboardOwner

A class which implements the capability required to transfer a simple java String in plain text format.


Constructor Summary
StringSelection(String data)
          Creates a transferable object capable of transferring the specified string in plain text format.
 
Method Summary
 Object getTransferData(DataFlavor flavor)
          If the data was requested in the "java.lang.String" flavor, return the String representing the selection.
 DataFlavor[] getTransferDataFlavors()
          Returns the array of flavors in which it can provide the data.
 boolean isDataFlavorSupported(DataFlavor flavor)
          Returns whether the requested flavor is supported by this object.
 void lostOwnership(Clipboard clipboard, Transferable contents)
          Notifies this object that it is no longer the owner of the contents of the clipboard.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringSelection

public StringSelection(String data)
Creates a transferable object capable of transferring the specified string in plain text format.
Method Detail

getTransferDataFlavors

public DataFlavor[] getTransferDataFlavors()
Returns the array of flavors in which it can provide the data.
Specified by:
getTransferDataFlavors in interface Transferable
Tags copied from interface: Transferable
Returns:
an array of data flavors in which this data can be transferred

isDataFlavorSupported

public boolean isDataFlavorSupported(DataFlavor flavor)
Returns whether the requested flavor is supported by this object.
Specified by:
isDataFlavorSupported in interface Transferable
Parameters:
flavor - the requested flavor for the data

getTransferData

public Object getTransferData(DataFlavor flavor)
                       throws UnsupportedFlavorException,
                              IOException
If the data was requested in the "java.lang.String" flavor, return the String representing the selection.
Specified by:
getTransferData in interface Transferable
Parameters:
flavor - the requested flavor for the data
Throws:
UnsupportedFlavorException - if the requested data flavor is not supported in the "java.lang.String" flavor.

lostOwnership

public void lostOwnership(Clipboard clipboard,
                          Transferable contents)
Description copied from interface: ClipboardOwner
Notifies this object that it is no longer the owner of the contents of the clipboard.
Specified by:
lostOwnership in interface ClipboardOwner
Tags copied from interface: ClipboardOwner
Parameters:
clipboard - the clipboard that is no longer owned
contents - the contents which this owner had placed on the clipboard

JavaTM 2 Platform
Standard Edition

Submit a bug or feature
Java, Java 2D, and JDBC are a trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-1999 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.