RFR: 8309460: JScrollBar leaves behind clutter for non-integer UI scales

Harshitha Onkar honkar at openjdk.org
Sun Jan 21 05:14:28 UTC 2024


On Thu, 18 Jan 2024 11:09:12 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:

> Lines  are left behind when moving the scrollbar in the positive direction. but are cleaned up on mouse release. 
> Additonally, with right arrow clicks too, the lines are left behind.
> Seems like for mouseDragged and scrollByUnit, the dirty region of the scrollbar is not repainted leading to artifacts
> which is being done in this fix..

The fix works fine. The artifacts or lines are no longer visible.
But noticed a couple of things when testing. (Win 11)

1. The lines happen to occur for **non-standard fractional scales** (2.3, 2.7) but work fine for **standard fractional scales** supported by windows (1.25,1.75, 2.25...)

2. The lines are left behind only in one direction - right for horizontal scroll and down for vertical scroll.

3. With the present fix repaint is called each time mouse is dragged or clicked, this results in a lot of calls to repaint during scrolling action.

test/jdk/javax/swing/JScrollBar/JScrollBarArtifactTest.java line 42:

> 40:     private static final String instructionsText = """
> 41:             This test is used to verify that dragging scrollbar or clicking
> 42:             on right scrollbar thumb does nto leave behing lines or artifacts.

Suggestion:

            on right scrollbar thumb does not leave behind lines or artifacts.

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

PR Review: https://git.openjdk.org/jdk/pull/17484#pullrequestreview-1834275178
PR Review Comment: https://git.openjdk.org/jdk/pull/17484#discussion_r1460131311


More information about the client-libs-dev mailing list