Java Platform 1.2

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)
           
 
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

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)
Specified by:
lostOwnership in interface ClipboardOwner

Java Platform 1.2

Submit a bug or feature Version 1.2 of Java Platform API Specification
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-1998 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.