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

REGRESSION: Mouse dragged events obey drag sensitivity

    XMLWordPrintable

    Details

    • Subcomponent:
    • Introduced In Build:
      b32
    • Introduced In Version:
      6
    • Resolved In Build:
      b85
    • CPU:
      x86
    • OS:
      windows_xp

      Description

      A DESCRIPTION OF THE REGRESSION :
      Mouse dragged events are not delivered when the sensitivity threshold is not reached. This poses a problem for my GUI builder as moving components does not work correctly anymore. The user can not any longer move a component by 1 pixel, they have to move a component about 15 pixels and then move the component 14 pixels back. On windows the threshold seems to be taken from the windows registry: HKEY_CURRENT_USER/Control Panel/Desktop/DragWith (DragHeight). When the threshold is set to 30, the mouse needs to be dragged about 15 pixels until I receive a mouseDragged event on the panel.


      REPRODUCIBLE TESTCASE OR STEPS TO REPRODUCE:
      public class MouseDragTest
      {
          public static void main(String[] args)
          {
              JFrame frame = new JFrame();

              frame.getContentPane().addMouseListener(new MouseAdapter()
              {
                  public void mousePressed(MouseEvent e)
                  {
                      System.out.println("pressed at (" + e.getX() + ", " + e.getY() + ")");
                  }
              });

              frame.getContentPane().addMouseMotionListener(new MouseMotionListener()
              {
                  public void mouseDragged(MouseEvent e)
                  {
                      System.out.println("dragged at (" + e.getX() + ", " + e.getY() + ")");
                  }


                  public void mouseMoved(MouseEvent e)
                  {
                  }
              });

              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              frame.setBounds(100, 100, 200, 200);
              frame.setVisible(true);
          }
      }

      Sample output while pressing & dragging the mouse on the frames contentPane (1.5.0_06):
      pressed at (99, 58)
      dragged at (99, 59)
      dragged at (99, 60)
      dragged at (99, 61)
      dragged at (99, 62)
      dragged at (99, 63)
      dragged at (99, 64)

      The mouseDragged handler is invoked for every pixel the mouose is dragged.

      The same procedure tested on Java(TM) SE Runtime Environment (build 1.6.0-beta2-b76)
      pressed at (84, 53)
      dragged at (84, 69)
      dragged at (84, 70)
      dragged at (84, 71)
      dragged at (84, 72)
      dragged at (84, 73)
      dragged at (84, 74)

      the first dragged event is received after the mouse is moved 15 pixels from the starting point (threshold/2).


      RELEASE LAST WORKED:
      5.0 Update 6

      RELEASE TEST FAILS:
      mustang-beta

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The mouse dragged listener should be notified for every mouse event and should not obey the drag sensitivity setting of the operating system.
      ACTUAL -
      Mouse dragged events are received after the drag sensitivity setting of the operating system is reached.

      OBSERVED APPLICATION IMPACT:
      Probably every java application using MouseMotionListeners will change the behaviour.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              dav Andrei Dmitriev (Inactive)
              Reporter:
              ttzhang Tao Zhang
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: