Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4746177

DnD of an URL from Mozilla (Netscape 6.2) to Java doesn't work

XMLWordPrintable

    • mantis
    • generic
    • generic



      Name: dsR10078 Date: 09/12/2002

      ###@###.###

      The problem is reproducible with JDK 1.4.1-b21 on linux and solaris.
      To reproduce compile and run the following test case:
      -----------------------------------------------------------------------------------
      import java.awt.*;
      import java.awt.datatransfer.*;
      import java.awt.dnd.*;

      public class DnDTest {
           public static void main(String[] args) {
               final Frame f = new Frame("Source");
               final DropTargetListener dtl = new DropTargetAdapter() {
                       public void drop(DropTargetDropEvent dtde) {
                           int action = dtde.getDropAction();
                           System.out.println("[Target] drop");
                           if (action != DnDConstants.ACTION_NONE) {
                               dtde.acceptDrop(action);
                               Transferable t = dtde.getTransferable();
                               DataFlavor[] dfs = t.getTransferDataFlavors();
                               System.out.println(dfs.length + " flavors available");
                               for (int i = 0; i < dfs.length; i++) {
                                   System.out.println(" " + dfs[i]);
                               }
                               dtde.dropComplete(true);
                           } else {
                               dtde.rejectDrop();
                           }
                       }
                   };
               final DropTarget dt = new DropTarget(f, dtl);
               f.setBounds(100, 100, 200, 200);
               f.setVisible(true);
           }
      }
      -----------------------------------------------------------------------------------
      A frame will appear.
      Run Netscape 6.2, drag an URL from browser and drop it onto a frame.
      The console output of the test reports that no flavors are available:
      -----------------------------------------------------------------------------------
      [Target] drop
      0 flavors available
      -----------------------------------------------------------------------------------
      The browser version string:
      Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.4) Gecko/20020326

      Note that the problem is not reproducible with Netscape 4.76.
      When an URL is dragged from it and dropped onto the Java frame the output is as follows:
      -----------------------------------------------------------------------------------
      [Target] drop
      25 flavors available
          java.awt.datatransfer.DataFlavor[mimetype=application/x-java-serialized-object;representationclass=java.lang.String]
          java.awt.datatransfer.DataFlavor[mimetype=application/x-java-file-list;representationclass=java.util.List]
          java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=java.io.Reader]
          java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=java.lang.String]
          java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=java.nio.CharBuffer]
          java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=[C]
          java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=java.io.InputStream;charset=UTF-16]
          java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=java.nio.ByteBuffer;charset=UTF-16]
          java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=[B;charset=UTF-16]
          java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=java.io.InputStream;charset=UTF-8]
          java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=java.nio.ByteBuffer;charset=UTF-8]
          java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=[B;charset=UTF-8]
          java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=java.io.InputStream;charset=UTF-16BE]
          java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=java.nio.ByteBuffer;charset=UTF-16BE]
          java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=[B;charset=UTF-16BE]
          java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=java.io.InputStream;charset=UTF-16LE]
          java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=java.nio.ByteBuffer;charset=UTF-16LE]
          java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=[B;charset=UTF-16LE]
          java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=java.io.InputStream;charset=unicode]
          java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=java.io.InputStream;charset=ISO-8859-1]
          java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=java.nio.ByteBuffer;charset=ISO-8859-1]
          java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=[B;charset=ISO-8859-1]
          java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=java.io.InputStream;charset=US-ASCII]
          java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=java.nio.ByteBuffer;charset=US-ASCII]
          java.awt.datatransfer.DataFlavor[mimetype=text/plain;representationclass=[B;charset=US-ASCII]
      -----------------------------------------------------------------------------------
      ======================================================================

            dassunw Das Das (Inactive)
            dassunw Das Das (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: