JDK-6383397 : Alt button is hiding mouse wheel event
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 6
  • Priority: P3
  • Status: Closed
  • Resolution: Won't Fix
  • OS: windows_xp
  • CPU: generic
  • Submitted: 2006-02-09
  • Updated: 2011-01-19
  • Resolved: 2006-02-14
Related Reports
Relates :  
Description
If the user press Alt button then next mouse wheel events are missed. Try to reproduce it by following sample code:

import javax.swing.JFrame;
import java.awt.Container;
import java.awt.event.MouseWheelListener;
import java.awt.event.MouseWheelEvent;

public class Test extends JFrame {
    public Test() {
        Container cp = getContentPane();
        cp.addMouseWheelListener(new MouseWheelListener(){
            public void mouseWheelMoved(MouseWheelEvent e) {
                System.out.println("Done");
            }
        });

        setSize(100, 100);
        setVisible(true);
    }

    public static void main(String[] args) {
        new Test();
    }
}

When you start the program above and drag the mouse wheel then "Done" is printed on the Console any time you drag the mouse wheel. But once you press Alt button then nothig is printed when you drag mouse wheel again.

The bug was reproduced in jdk6 b69.

However when you press any key once more all the events are working afresh.

Comments
EVALUATION I'm going to close it with "will not fix" status. That's obviously a bug but a system one. Simplest application to reproduce it is just basic AWT Frame with listeners. If you'd spy for this window using Spy++, you would see that it just doesn't receive mouse wheel events after an Alt is pressed. Now, pressing Alt makes Windows to send WM_ENTERMENULOOP message to an application. What if there's no menu, as in our basic example? Find a native application without menu and try. For instance, some Windows Help (use IE, not Mozilla!) has an article Frame to the right; mouse-scroll it; press Alt, you'll not activate any menu as there's no; and you will not be able to scroll any more until a next non-wheel event.
14-02-2006

EVALUATION Note that on Windows pressing Alt once does transfer focus to a menu, if any. Any other event returns focus back however, including mouse wheel event. See also 6374321 about TextField behavior.
13-02-2006

EVALUATION On Windows with every JDK starting from 1.4.2. Pressing and relesing Alt key leads to silent console. Second press (and release) of Alt (and other keys) restores initial state. But if I press ALT and hold it pressed and then rotate the wheel - it works well and listener reports about correct modifiers and ExModifiers. So seems Alt key just change state that prevent event transfer to listeners.
10-02-2006