JDK-6440198 : Apple and Microsoft users want horizontal scroll wheel support
  • Type: Enhancement
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 6,7
  • Priority: P3
  • Status: Open
  • Resolution: Unresolved
  • OS: linux,os_x
  • CPU: x86
  • Submitted: 2006-06-19
  • Updated: 2019-03-23
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
tbdUnresolved
Related Reports
Relates :  
Description
A DESCRIPTION OF THE REQUEST :
Apple and Microsoft users expect horizontal scrolling to work in JScrollPane, but it doesn't.

There's effectively a duplicate bug for this, but it's more general (covering tablets and the like), and I fear that we may have support for basic and increasingly common functionality (see below) while waiting for the more general functionality that's probably useful to a much smaller group of users (and thus easily skipped over in defect review meetings).

In particular 6315717 has a wrong evaluation (seemingly mislead by the correct evaluation of 6260940) that might be helped by the pointers to documentation I provide below. Perhaps those bugs should be used for the issue of extra button support, and this new bug used for the issue of extra wheel support. Both in terms of the underlying native implementation and the required Java API/source changes, the two issues are very clearly distinct, even if they're considered similar from a user perspective. (Again, this may have led to the incorrect evaluation.)

JUSTIFICATION :
Mac users now have either Apple's so-called "Mighty" Mouse with an actual horizontal wheel, or modern MacBooks/MacBook Pros where there's a trackpad gesture that's presented as a horizontal scroll wheel event.

Microsoft users have a variety of mice that offer horizontal scroll wheels.

Apple and Microsoft users ask us to support horizontal scroll wheels, and we're faced with writing JNI for each platform or saying "sorry, Java applications don't work as well as native applications".

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
I'd like to see AWT enhanced to support MouseWheelEvents representing horizontal wheel scrolling.

Here's how MS do it:

  http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwui/html/BestPracticesforSupportingMicrosoftMouseandKeyboardDevices.asp

And here's how X11 does it:

  http://www.xfree86.org/current/mouse.4.html

For reference, even though the Mac OS implementation isn't your problem, here's how Apple do it:

  http://developer.apple.com/qa/qa2005/qa1453.html

(At a higher level, their NSEvent class has deltaX, deltaY, and deltaZ properties.)

I'd then like to see JScrollPane enhanced to replace the following snippet with code that takes the kind of MouseWheelEvent into account when choosing which scroll bar to affect:

        public void mouseWheelMoved(MouseWheelEvent e) {
            if (scrollpane.isWheelScrollingEnabled() &&
                e.getWheelRotation() != 0) {
                JScrollBar toScroll = scrollpane.getVerticalScrollBar();
                int direction = e.getWheelRotation() < 0 ? -1 : 1;
                int orientation = SwingConstants.VERTICAL;
                
                // find which scrollbar to scroll, or return if none
                if (toScroll == null || !toScroll.isVisible()) {
                    toScroll = scrollpane.getHorizontalScrollBar();
                    if (toScroll == null || !toScroll.isVisible()) {
                        return;
                    }
                    orientation = SwingConstants.HORIZONTAL;
                }

ACTUAL -
Only vertical scrolling works.

---------- BEGIN SOURCE ----------
Use one of the JScrollPanes in SwingSet.
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
Native code and our own subclasses. A lot of hard work.

Altering AWT and Swing. Much less work, but not legal to redistribute, which defeats the purpose.

Comments
Horizontal scroll was implemented on Windows in `JDK-4419271
04-07-2017

- this is an issue reported against 7(7u), - there are now affected version 9 filed for this issue - 7u issues are transferred to Sustaining Nevertheless if someone have a report against 9 - please reopen and add affectedVersion 9 or 7u specific escalations might be reopen to Sustaining
10-08-2014

- this is an issue reported against 7(7u), - there are now affected version 9 filed for this issue - 7u issues are transferred to Sustaining Nevertheless if someone have a report against 9 - please reopen and add affectedVersion 9 or 7u specific escalations might be reopen to Sustaining
10-08-2014