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

DropTargetDragEvent.acceptDrag(int) doesn't work

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P4
    • None
    • 1.4.2
    • client-libs
    • x86
    • windows_2000

    Description

      Name: rmT116609 Date: 05/06/2004


      FULL PRODUCT VERSION :
      java version "1.4.2_01"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_01-b06)
      Java HotSpot(TM) Client VM (build 1.4.2_01-b06, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows 2000 [Version 5.00.2195]

      A DESCRIPTION OF THE PROBLEM :
      DropTargetDragEvent.acceptDrag(DnDConstants.ACTION_COPY) doesn't work
      This line doesn't achieve anything.

      By holding down ctrl the copy icon appears, however the above line should make the copy icon appear without having to hold down ctrl.
      Leaving out the above line in the code makes no difference to the outcome.
      Users are lead to believe they can't drop, when in fact they can drop by copying.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      run code
      highlight and drag text

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      the icon to look like the copy icon
      ACTUAL -
      the icon looks like the can't drop icon

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.awt.dnd.*;
      import java.util.*;
      import javax.swing.*;

      public class Test {
        public static void main(String[] args) {
          JFrame frame = new JFrame();
          JTextField text = new JTextField("Drag Me");
          text.setDragEnabled(true);
          try {
            text.getDropTarget().addDropTargetListener(new DropTargetAdapter() {
              public void dragOver(DropTargetDragEvent dtde) {
                dtde.acceptDrag(DnDConstants.ACTION_COPY);
              }

              public void drop(DropTargetDropEvent dtde) {
              }
            });
          }
          catch (TooManyListenersException ex) {
            System.out.println("Error.... " + ex);
          }
          frame.getContentPane().add(text);
          frame.setSize(500, 500);
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          frame.setVisible(true);
        }
      }
      ---------- END SOURCE ----------
      (Incident Review ID: 225126)
      ======================================================================

      Attachments

        Issue Links

          Activity

            People

              shickeysunw Shannon Hickey (Inactive)
              rmandalasunw Ranjith Mandala (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: