Package org.jmol.awt

Class AwtClipboard

  • All Implemented Interfaces:
    java.awt.datatransfer.Transferable

    public class AwtClipboard
    extends java.lang.Object
    implements java.awt.datatransfer.Transferable
    This class is used to transfer text or an image into the clipboard and to get tet from the clipboard. Simplified by Bob Hanson
    Author:
    Nicolas Vervelle
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.awt.Image image
      The image to transfer into the clipboard.
      private java.lang.String text  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private AwtClipboard​(java.lang.Object image)  
    • Field Detail

      • image

        private java.awt.Image image
        The image to transfer into the clipboard.
      • text

        private java.lang.String text
    • Constructor Detail

      • AwtClipboard

        private AwtClipboard​(java.lang.Object image)
    • Method Detail

      • setClipboard

        public static void setClipboard​(java.lang.Object textOrImage)
        Transfers text or image into the clipboard.
        Parameters:
        textOrImage - to transfer into the clipboard.
      • getTransferDataFlavors

        public java.awt.datatransfer.DataFlavor[] getTransferDataFlavors()
        Specified by:
        getTransferDataFlavors in interface java.awt.datatransfer.Transferable
      • isDataFlavorSupported

        public boolean isDataFlavorSupported​(java.awt.datatransfer.DataFlavor flavor)
        Specified by:
        isDataFlavorSupported in interface java.awt.datatransfer.Transferable
      • getTransferData

        public java.lang.Object getTransferData​(java.awt.datatransfer.DataFlavor flavor)
                                         throws java.awt.datatransfer.UnsupportedFlavorException,
                                                java.io.IOException
        Specified by:
        getTransferData in interface java.awt.datatransfer.Transferable
        Throws:
        java.awt.datatransfer.UnsupportedFlavorException
        java.io.IOException
      • getClipboardText

        public static java.lang.String getClipboardText()
        Get the String residing on the clipboard. Or, if it is a file list, get the load command associated with that. from http://www.javapractices.com/Topic82.cjp
        Returns:
        any text found on the Clipboard; if none found, return an empty String.