1 Reply Latest reply on Jul 23, 2001 4:17 AM by 843807

    how to drag and drop image between Windows platform and VM

    843807
      Thanks.
        • 1. Re: how to drag and drop image between Windows platform and VM
          843807
          Hi Deer2000,

          There are several things you need to do first. You need a Transferable that can provide the image data in a format that the application likes. You will not be able to drop a serialized ImageIcon onto a native app for example. Most won't accept a binary stream even if you declare it's MIME type (e.g. image/jpeg) either.

          You need to know what the native "clipboard" formats are. For example on Win32, DIB (device independent bitmap) and BITMAP are clipboard image formats. Learn the format and write an InputStream the can provide it. Then add your stream to a FlavorMap.

          What is a FlavorMap and why do I need one?

          Most native apps don't understand MIME types for data transfer. They have their own "clipboard" types. Java DataFlavors are based on MIME types. In order to provide a mapping between the win32 format TEXT and MIME types text/plain;charset=ascii you create a FlavorMap. Actually the default system flavormap does this type for you.
          An easy way to add mappings is to edit $JDKHOME/jre/lib/flavormap.properties. For our custom image stream we've added the following entry:

          DIB=image/x-win-bmp;class=com.rockhoppertech.dnd.datatransfer.BitmapInputStream

          Other Win32 clipboard formats are:

          WAVE
          RIFF
          PALETTE
          ENHMETAFILE
          METAFILEPICT
          DIB
          TIFF


          Or please refer this URL, which gives a good idea about drag and drop in Java

          http://www.rockhoppertech.com/java-drag-and-drop-faq.html


          I hope this will help you.

          Thanks
          Bakrudeen