United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6524352 support for high-resolution mouse wheel
JDK-6524352 : support for high-resolution mouse wheel

Details
Type:
Bug
Submit Date:
2007-02-13
Status:
Closed
Updated Date:
2011-05-17
Project Name:
JDK
Resolved Date:
2011-05-17
Component:
client-libs
OS:
windows_vista
Sub-Component:
java.awt
CPU:
x86
Priority:
P3
Resolution:
Fixed
Affected Versions:
6,7
Fixed Versions:

Related Reports
Backport:
Backport:
Backport:
Backport:
Relates:

Sub Tasks

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
SUGGESTED FIX

http://sa.sfbay.sun.com/projects/awt_data/7/6524352/
                                     
2007-03-26
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.
                                     
2007-03-26
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.
                                     
2007-08-31



Hardware and Software, Engineered to Work Together