RFR: 6318027: BasicScrollBarUI does not disable timer when enclosing frame is disabled. [v7]

Abhishek Kumar abhiscxk at openjdk.org
Tue Aug 20 10:03:51 UTC 2024


On Tue, 20 Aug 2024 07:49:07 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:

>> Issue is
>> BasicScrollBarUI.ArrowButtonListener starts a timer in mousePressed(), and stops it in mouseReleased(). If the frame containing the scrollbar is disabled between the MOUSE_PRESSED and the MOUSE_RELEASED events, the mouseReleased() method is never called. If the frame is then re-enabled, the still-running timer causes it to scroll all the way to the end.
>> Fix is to check if [ArrowButtonListener.handledEvent](https://github.com/openjdk/jdk/blame/ee839b7f0ebe471d3877cddd2c87019ccb8ee5ae/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicScrollBarUI.java#L1567) is still set when ActionEvent is processed then stop the timer and reset this variable.
>> 
>> CI testing is green and also SwingSet2 JScrollPane scrolling with this modification..
>
> Prasanta Sadhukhan has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Expand imports

minor sorting of imports.

src/java.desktop/macosx/classes/com/apple/laf/AquaScrollBarUI.java line 35:

> 33: import java.awt.Point;
> 34: import java.awt.Rectangle;
> 35: import java.awt.Insets;

Suggestion:

import java.awt.Graphics;
import java.awt.Insets;
import java.awt.Point;
import java.awt.Rectangle;

src/java.desktop/macosx/classes/com/apple/laf/AquaScrollBarUI.java line 61:

> 59: import apple.laf.JRSUIConstants.Hit;
> 60: import apple.laf.JRSUIConstants.Orientation;
> 61: import apple.laf.JRSUIConstants.NothingToScroll;

Suggestion:

import apple.laf.JRSUIConstants.Hit;
import apple.laf.JRSUIConstants.NothingToScroll;
import apple.laf.JRSUIConstants.Orientation;

-------------

PR Review: https://git.openjdk.org/jdk/pull/20346#pullrequestreview-2247551270
PR Review Comment: https://git.openjdk.org/jdk/pull/20346#discussion_r1723045015
PR Review Comment: https://git.openjdk.org/jdk/pull/20346#discussion_r1723046222


More information about the client-libs-dev mailing list