United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: 6730447 Support for high resolution mouse wheel is still incomplete. AWT panel needs to be supported
6730447 : Support for high resolution mouse wheel is still incomplete. AWT panel needs to be supported

Details
Type:
Bug
Submit Date:
2008-07-28
Status:
Closed
Updated Date:
2011-03-11
Project Name:
JDK
Resolved Date:
2009-05-15
Component:
client-libs
OS:
windows_vista
Sub-Component:
java.awt
CPU:
x86
Priority:
P3
Resolution:
Fixed
Affected Versions:
6u7
Fixed Versions:
6u14

Related Reports
Backport:
Relates:
Relates:

Sub Tasks

Description
Bug 6524352 support for high-resolution mouse wheel  has been  fixed in case that the MouseWheelListener is attached to a Frame or JFrame.

However, if the MouseWheelListener is tied to an AWT panel, the issue persists:



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

public class Jmouse2 extends Frame {

    public Jmouse2() {
        super("Jmouse2");
        this.setLayout(new BorderLayout());
        Panel ds_pnl = new Panel();
        ds_pnl.setBackground(Color.green);
        this.add(ds_pnl, BorderLayout.CENTER);
        ds_pnl.addMouseWheelListener(new MouseWheelListener() {
            public void mouseWheelMoved(MouseWheelEvent e) {
                System.out.println(e);
            }
        });
    }

    public static void main(String[] args) {
        Jmouse2 ms = new Jmouse2();
        ms.setVisible(true);
    }
}

                                    

Comments
SUGGESTED FIX

http://sa.sfbay.sun.com/projects/awt_data/6u14/6730447
                                     
2009-02-10
EVALUATION

The problem appears when an application has a top-level and the top-level contains at least one HW component. In the attached testcase the component is an AWT panel.

The spec for the MouseWheelEvent classes says that
"If MouseWheelEvents are not enabled on the Component, the event is delivered to the first ancestor Container with MouseWheelEvents enabled"

AWT calls DefWindowProc for the mouse wheel events (AwtComponent::PostHandleEventMessage routine) and DefWindowProc propagates it up the parent chain until it finds a window that processes it, this window is top-level.

The fix for 6524352 expects that it's OK to have toolkit-level variables to  accumulate the mouse wheel messages. This works OK until the messages are propagated up to the HW parent. A possible fix for the problem would be to have component-level variables to accumulate the mouse wheel messages.
                                     
2009-01-30
EVALUATION

In fact the bug is not related to 6682046, the issue still exists in latest 6u10.
                                     
2008-09-25
EVALUATION

The root cause of the problem is the same as the cause of the bug 6682046. As a result of the bug 6682046 - if user resizes the frame, the content of the frame keeps the same size and any mouse event outside the content is missed. The issue shouldn't be reproducible using the latest build that includes the fix for the bug 6682046.
                                     
2008-08-18



Hardware and Software, Engineered to Work Together