Advanced   Java   Services Die Klasse TransferableImage Back Next Up Home



Class TransferableImage

java.lang.Object
  extended byTransferableImage
All Implemented Interfaces:
java.awt.datatransfer.ClipboardOwner, java.awt.datatransfer.Transferable

public class TransferableImage
extends java.lang.Object
implements java.awt.datatransfer.Transferable, java.awt.datatransfer.ClipboardOwner

Die Klasse TransferableImage dient zum Datenaustausch mit dem SystemClipboard. Mit ihr können Image und ImageIconobjekte in Objekte vom Typ TransferableImage verwandelt werden. Objekte der Klasse TransferableImage können mit der Methode clipboard.setContents(Transferable contents, ClipboardOwner owner) an das Clipboard übergeben werden und dann in andere Anwendungen eingefügt werden.

Version:
1.0
Author:
Herbert Max Straub

Constructor Summary
TransferableImage(java.awt.image.BufferedImage bImg)
          Creates a TransferableImage from a BufferedImage
TransferableImage(java.awt.Image img)
          Creates a TransferableImage from an Image
TransferableImage(javax.swing.ImageIcon ic)
          Creates a TransferableImage from an ImageIcon
 
Method Summary
 java.lang.Object getTransferData(java.awt.datatransfer.DataFlavor imageFlavor)
          Returns an object which represents the data to be transferred, if the flavor is DataFlavor.imageFlavor
 java.awt.datatransfer.DataFlavor[] getTransferDataFlavors()
          Returns DataFlavor.imageFlavor as an array of length 1.
 boolean isDataFlavorSupported(java.awt.datatransfer.DataFlavor flavor)
          Returns true if and only if the parameter value is DataFlavor.imageFlavor.
 void lostOwnership(java.awt.datatransfer.Clipboard clipboard, java.awt.datatransfer.Transferable contents)
          Does nothing, included for type compatibility
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TransferableImage

public TransferableImage(javax.swing.ImageIcon ic)
Creates a TransferableImage from an ImageIcon


TransferableImage

public TransferableImage(java.awt.Image img)
Creates a TransferableImage from an Image


TransferableImage

public TransferableImage(java.awt.image.BufferedImage bImg)
Creates a TransferableImage from a BufferedImage

Method Detail

getTransferData

public java.lang.Object getTransferData(java.awt.datatransfer.DataFlavor imageFlavor)
                                 throws java.awt.datatransfer.UnsupportedFlavorException
Returns an object which represents the data to be transferred, if the flavor is DataFlavor.imageFlavor

Specified by:
getTransferData in interface java.awt.datatransfer.Transferable
Throws:
java.awt.datatransfer.UnsupportedFlavorException

getTransferDataFlavors

public java.awt.datatransfer.DataFlavor[] getTransferDataFlavors()
Returns DataFlavor.imageFlavor as an array of length 1.

Specified by:
getTransferDataFlavors in interface java.awt.datatransfer.Transferable

isDataFlavorSupported

public boolean isDataFlavorSupported(java.awt.datatransfer.DataFlavor flavor)
Returns true if and only if the parameter value is DataFlavor.imageFlavor.

Specified by:
isDataFlavorSupported in interface java.awt.datatransfer.Transferable

lostOwnership

public void lostOwnership(java.awt.datatransfer.Clipboard clipboard,
                          java.awt.datatransfer.Transferable contents)
Does nothing, included for type compatibility

Specified by:
lostOwnership in interface java.awt.datatransfer.ClipboardOwner


Valid XHTML 1.0 Strict top Back Next Up Home