JDK-6524352 : support for high-resolution mouse wheel
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 6,7
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: windows_vista
  • CPU: x86
  • Submitted: 2007-02-13
  • Updated: 2017-05-16
  • Resolved: 2011-05-17
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other JDK 6 JDK 7
1.4.2_18-revFixed 6u10Fixed 7 b25Fixed
Related Reports
Relates :  
Relates :  
Description
FULL PRODUCT VERSION :
java version "1.6.0"
Java(TM) SE Runtime Environment (build 1.6.0-b105)
Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
Windows Vista Ultimate Edition
Microsoft Windows [Version 6.0.6000]


EXTRA RELEVANT SYSTEM CONFIGURATION :
Microsoft Wireless Optical Mouse 2.0
Logitech LX3 Optical Mouse (corded)
Microsoft IntelliPoint 6.1

A DESCRIPTION OF THE PROBLEM :
When using the mouse scroll wheel within AWT and Swing applications I get different behaviour when using different mice on my Windows Vista system.

When using a Microsoft Wireless Optical Mouse 2.0, mouse wheel scrolling does not work correctly. This occurs regardless of whether Microsoft IntelliPoint software is installed or not. The mouse wheel scrolling works fine in all other (non-Java) applications.

Switching the mouse to an alternative (in my case a Logitech LX3 Optical Mouse) and the mouse wheel scrolling works correctly in all AWT and Swing applications.

Using the following simple Swing application:

import java.awt.event.MouseWheelListener;
import java.awt.event.MouseWheelEvent;
import javax.swing.*;

public class MouseScroller extends JFrame {

    public MouseScroller() {
        super("Mouse Scroller");
        addMouseWheelListener(new MouseWheelListener() {
            public void mouseWheelMoved(MouseWheelEvent e) {
                System.out.println(e);
            }
        });
    }

    public static void main(String[] args) {
        MouseScroller ms = new MouseScroller();
        ms.setVisible(true);
    }
}
 
If using the scroll wheel while within the JFrame area I get the following output:

Microsoft Wireless Optical Mouse 2.,0:
java.awt.event.MouseWheelEvent[MOUSE_WHEEL,(586,916),absolute(0,0),button=0,clickCount=0,scrollType=WHEEL_UNIT_SCROLL,scrollAmount=16,wheelRotation=0] on frame0

Note that the wheelRotation property is always set to 0 regardless of whether I scroll the mouse wheel up or down.


Logitech LX3 Optical Mouse:
java.awt.event.MouseWheelEvent[MOUSE_WHEEL,(131,129),absolute(0,0),button=0,clickCount=0,scrollType=WHEEL_UNIT_SCROLL,scrollAmount=16,wheelRotation=-1] on frame0
java.awt.event.MouseWheelEvent[MOUSE_WHEEL,(131,129),absolute(0,0),button=0,clickCount=0,scrollType=WHEEL_UNIT_SCROLL,scrollAmount=16,wheelRotation=1] on frame0

The wheelRotation property is set to -1 or 1 as would be expected when I scroll the wheel first up then down.




REPRODUCIBILITY :
This bug can be reproduced always.

Comments
EVALUATION The following API changes are going to be made: The existing getWheelRotation method of the MouseWheelRotation class returns the integer number of "clicks" on which the mouse wheel was rotated, the integer number of "clicks" corresponding to a number notches on which the wheel was rotated. In case when partial rotations occur, the method will return zero until an accumulated "click" is come. Also, the MouseWheelEvent class will include additional getPreciseWheelRotation method. The additional method returns the double number of "clicks" if partial rotation occured. So application will be able to use benefits of high-resolution mouse wheel.
31-08-2007

SUGGESTED FIX http://sa.sfbay.sun.com/projects/awt_data/7/6524352/
26-03-2007

EVALUATION Current AWT implementation triggers mouse wheel events but wheel rotation of the events equals zero. It happens because we expect that wheel rotation of native event is multiple of WHEEL_DELTA, which is set to 120. It's wrong. MSDN states that in fact native system may send more messages per rotation, but with a smaller wheel rotation value in each message. So we may add the incoming delta values until WHEEL_DELTA is reached and only after that trigger wheel event.
26-03-2007