org.akutan.blacklitterman.gui
Class StringTransferable

java.lang.Object
  extended by org.akutan.blacklitterman.gui.StringTransferable
All Implemented Interfaces:
java.awt.datatransfer.Transferable

public class StringTransferable
extends java.lang.Object
implements java.awt.datatransfer.Transferable

Implements Transferable to allow Strings to be cut/paste via the clipboard. Taken from the sun 1.4 ExtendedDnDDemo.java example.


Field Summary
protected  java.lang.String _s
           
 
Constructor Summary
StringTransferable(java.lang.String s)
          Constructs
 
Method Summary
 java.lang.Object getTransferData(java.awt.datatransfer.DataFlavor arg0)
          Get the data to be transferred in the flavor specified.
 java.awt.datatransfer.DataFlavor[] getTransferDataFlavors()
          Returns a list of available data flavors.
 boolean isDataFlavorSupported(java.awt.datatransfer.DataFlavor arg0)
          Checks to see if the specified flavor is supported.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_s

protected java.lang.String _s
Constructor Detail

StringTransferable

public StringTransferable(java.lang.String s)
Constructs

Parameters:
s - String to wrap for cut/paste
Method Detail

getTransferData

public java.lang.Object getTransferData(java.awt.datatransfer.DataFlavor arg0)
                                 throws java.awt.datatransfer.UnsupportedFlavorException,
                                        java.io.IOException
Get the data to be transferred in the flavor specified.

Specified by:
getTransferData in interface java.awt.datatransfer.Transferable
Parameters:
arg0 - DataFlavor for returned data. Ignored.
Returns:
The string inside.
Throws:
java.awt.datatransfer.UnsupportedFlavorException
java.io.IOException

getTransferDataFlavors

public java.awt.datatransfer.DataFlavor[] getTransferDataFlavors()
Returns a list of available data flavors. This simple object supports only text/html.

Specified by:
getTransferDataFlavors in interface java.awt.datatransfer.Transferable
Returns:
Array of supported flavors

isDataFlavorSupported

public boolean isDataFlavorSupported(java.awt.datatransfer.DataFlavor arg0)
Checks to see if the specified flavor is supported.

Specified by:
isDataFlavorSupported in interface java.awt.datatransfer.Transferable
Parameters:
arg0 - Flavor to check
Returns:
true indicates the flavor is supported