JDK-6539240 : JScrollPane's horizontal scroll bar sometimes works improperly when handled by mouse wheel
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 7,8,9
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS: generic
  • CPU: generic
  • Submitted: 2007-03-27
  • Updated: 2021-12-20
Related Reports
Relates :  
Description
The problem is visible when:
  - JScrollPane contains a JTree
  - JTree has such a size, that only horizontal scroll bar is visible
  - The tree has left-to-right orientation
  - The scroll pane has right-to-left orientation

Try to move the mouse cursor to the tree and to rotate the mouse wheel. The horizontal scroll bar will twitch from the left side to the right side instead of usual smooth moving.

See the attached test case.

Comments
not a regression for 8 and 9
12-12-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

- 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

SUGGESTED FIX The problem is in javax.swing.plaf.BasicScrollPaneUI.Handler.mouseWheelMoved(): src/share/classes/javax/swing/plaf/basic/BasicScrollPaneUI.java @@ -903,11 +903,11 @@ // accelerated wheel scrolling. Scrollable scrollComp = (Scrollable) comp; Rectangle viewRect = vp.getViewRect(); int startingX = viewRect.x; boolean leftToRight = - comp.getComponentOrientation().isLeftToRight(); + toScroll.getComponentOrientation().isLeftToRight(); int scrollMin = toScroll.getMinimum(); int scrollMax = toScroll.getMaximum() - toScroll.getModel().getExtent(); if (limitScroll) {
15-02-2008

EVALUATION It is a regression of 5078454. There is a flaw in the horizontal scrollbar position calculations. For determining of the scrollbar orientation the SplitPane's nested component orientation is used. It is the cause. A fix is simple. We should use scrollbar orientation for the calculations. The problem is in javax.swing.plaf.BasicScrollPaneUI.Handler.mouseWheelMoved(): src/share/classes/javax/swing/plaf/basic/BasicScrollPaneUI.java @@ -903,11 +903,11 @@ // accelerated wheel scrolling. Scrollable scrollComp = (Scrollable) comp; Rectangle viewRect = vp.getViewRect(); int startingX = viewRect.x; boolean leftToRight = - comp.getComponentOrientation().isLeftToRight(); + toScroll.getComponentOrientation().isLeftToRight(); int scrollMin = toScroll.getMinimum(); int scrollMax = toScroll.getMaximum() - toScroll.getModel().getExtent(); if (limitScroll) {
15-02-2008

EVALUATION The problem appears since jdk6. I didn't find it under 1.5.0_06, but found under 1.6 b65. Maybe it is a regression of 5078454.
27-03-2007