Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6440198

Apple and Microsoft users want horizontal scroll wheel support

XMLWordPrintable

    • x86
    • linux, os_x

      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.

            Unassigned Unassigned
            son Oleg Sukhodolsky (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: