JDK-6186575 : Scrollbar triggers adjustment event continuously when disabled, Solaris / linux
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 1.4.0
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS: generic
  • CPU: generic
  • Submitted: 2004-10-29
  • Updated: 2011-04-28
Description
Disabling a scrollbar when it is getting adjusted triggers adjument events continuously and the bubble automatically moves down till the end. The event generation stops only when the bubble moves to the lower end of the scrollbar. This is noticed on solaris9 (CDE) / linux (RH9) right from 1.4.

On win32, as soon as the scrollbar gets disabled, it gains focus and the bubble starts blinking (but actually there is no bubble there, only the focus border of the bubble blinks). When I press the down arrow, the blinking bubble moves 1 step down and vanishes. 

This is noticed on Motif as well as XToolkit. Reproducible right from 1.4. Reproducible on all platforms, but the behavior of the bug differs b/w win32 and solaris.

I have attached a sample test. Execute the test. You would see a frame with a scrollbar. Click the down arrow of the scrollbar with the mouse. Now the bubble will start moving and you will see a sequence of adj. events being triggered. Now re-run the application and click on the track this time. You will see events being triggered by scrollbar indefinitely.
###@###.### 10/29/04 10:53 GMT

Comments
SUGGESTED FIX --- XScrollbarPeer.java 2006-09-08 16:41:02.000000000 +0400 *************** *** 85,90 **** --- 85,94 ---- tsb.paint(g, colors, true); // paint the whole scrollbar } + + public void disable(){ + tsb.disable(); + } public void repaintScrollbarRequest(XScrollbar sb) { repaint(); --- XScrollbar.java 2006-09-08 16:56:19.000000000 +0400 *************** *** 420,425 **** --- 420,429 ---- abstract boolean beforeThumb(int x, int y); + public void disable(){ + scroller.stop(); + } + /** * * @see java.awt.event.MouseEvent
08-09-2006

EVALUATION The problem arises when we disabling the component while it's in autoscrolling mode. This means that XScrollbar is expecting MOUSE_RELEASED event to stop autoscrolling. But as it become disabled it would never comes so XScrollbar.handleMouseEvent() missed it. I'd suggest that XScrollbar should explicitly stop autoscroller when enabled property is about to change to false. MToolkit have the same issue and seem it's in motif code rather then in awt. There is already a workaround 4263104 in awt_motif.c: awt_motif_Scrollbar_ButtonReleaseHandler() but seem it doesn't solve this problem.
08-09-2006

EVALUATION Reproducible on Motif and XAWT both. ###@###.### 2005-03-10 13:07:20 GMT
10-03-2005