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

Default drag gesture recognizer always returns ACTION_MOVE

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 1.4.0
    • 1.4.0
    • client-libs
    • None
    • beta3
    • generic
    • generic
    • Verified



      Name: dsR10078 Date: 09/24/2001

      ###@###.###

      The problem can be reproduced with the following test case:
      -----------------------------------------------------------------------------------
      import java.awt.*;
      import java.awt.datatransfer.*;
      import java.awt.dnd.*;
      import java.awt.event.*;

      public class Test {
          public static void main(String[] args) {
              final Frame frame = new Frame();
              final Label label = new Label("label");
              final WindowAdapter windowListener = new WindowAdapter() {
                      public void windowClosing(WindowEvent e) {
                          frame.dispose();
                      }
                  };
              final DragSource dragSource = DragSource.getDefaultDragSource();
              final DragGestureListener dragGestureListener =
                  new DragGestureListener() {
                          public void dragGestureRecognized(DragGestureEvent dge) {
                              String action = "NONE";
                              switch (dge.getDragAction()) {
                              case DnDConstants.ACTION_COPY: action = "COPY"; break;
                              case DnDConstants.ACTION_MOVE: action = "MOVE"; break;
                              case DnDConstants.ACTION_LINK: action = "LINK"; break;
                              }
                              System.out.println("Recognized action: " + action);
                          }
                      };
              final DragGestureRecognizer dragGestureRecognizer =
                  dragSource.createDefaultDragGestureRecognizer(label,
                                                                DnDConstants.ACTION_COPY_OR_MOVE |
                                                                DnDConstants.ACTION_LINK,
                                                                dragGestureListener);
              frame.add(label);
              frame.addWindowListener(windowListener);
              frame.pack();
              frame.setVisible(true);
          }
      }
      -----------------------------------------------------------------------------------

      The bug exists in merlin b80 on Solaris and Win32.
      To reproduce:
      1.Compile and run the test case.
      2.A frame with a label will appear.
      3.Drag from the label.
      4.Note that the recognized action is ACTION_MOVE regardless
        of the keyboard modifiers state.

      The recognized action should match the current keyboard modifiers state.

      ###@###.### 2001-09-24
      ======================================================================

            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: