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

REGRESSION: MouseDragged and DragGestureRecognized events' order is swapped.

XMLWordPrintable

    • x86
    • windows_xp

      A DESCRIPTION OF THE REGRESSION :
      Create component. Add MouseMotionListener and DragGestureListener to it.
      Drag mouse across the component.

      REPRODUCIBLE TESTCASE OR STEPS TO REPRODUCE:
      import java.awt.dnd.DnDConstants;
      import java.awt.dnd.DragGestureEvent;
      import java.awt.dnd.DragGestureListener;
      import java.awt.dnd.DragSource;
      import java.awt.event.MouseEvent;
      import java.awt.event.MouseMotionListener;
      import java.awt.event.WindowEvent;
      import java.awt.event.WindowListener;

      import javax.swing.JFrame;
      import javax.swing.JPanel;

      public class TestApp {
      private final JFrame frame = new JFrame();
      private final JPanel panel = new JPanel();

      public static void main(String[] args) {
      new TestApp().start();
      }

      public void start() {
      frame.getContentPane().add(panel);
      panel.setSize(100, 100);
      panel.addMouseMotionListener(new MyMouseListener());
      frame.addWindowListener(new WindowListener() {
      public void windowActivated(WindowEvent e) {}
      public void windowClosed(WindowEvent e) {}
      public void windowClosing(WindowEvent e) {
      frame.dispose();
      System.exit(0);
      }
      public void windowDeactivated(WindowEvent e) {}
      public void windowDeiconified(WindowEvent e) {}
      public void windowIconified(WindowEvent e) {}
      public void windowOpened(WindowEvent e) {}
      });
      frame.show();
      }

      private class MyMouseListener implements MouseMotionListener {
      public MyMouseListener() {
      final DragSource dragSource = DragSource.getDefaultDragSource();
      DragGestureListener gesture = new DragGestureListener() {
      public void dragGestureRecognized(DragGestureEvent dge) {
      System.out.println("dragGestureRecognized");
      }
      };
      dragSource.createDefaultDragGestureRecognizer(panel,
      DnDConstants.ACTION_COPY_OR_MOVE, gesture);

      }
      public void mouseDragged(MouseEvent e) {
      System.out.println("mouseDragged");
      }
      public void mouseMoved(MouseEvent e) {}
      }
      }


      RELEASE LAST WORKED:
      5.0

      RELEASE TEST FAILS:
      mustang-b72

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      MouseDragged is the first fired event. DragGestureRecognized is fired later.
      ACTUAL -
      DragGestureRecognized is the first fired event, MouseDragged is the second one.

            agerasimsunw Alexander Gerasimov (Inactive)
            ttzhang Tao Zhang
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: