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

Alexey Ivanov aivanov at openjdk.org
Mon Jan 22 18:13:26 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..

However, I don't quite understand how repainting helps.

I could understand if you enlarged the rectangle along the orientation axis by 1 pixel in either direction, this would ensure any fractional pixels would always be repainted.

Is this bug similar to [JDK-8032219](https://bugs.openjdk.org/browse/JDK-8032219)?

src/java.desktop/share/classes/javax/swing/plaf/basic/BasicScrollBarUI.java line 1192:

> 1190:         scrollByUnits(scrollbar, direction, 1, false);
> 1191:         Rectangle r = getTrackBounds();
> 1192:         scrollbar.repaint(r.x, r.y, r.width, r.height);

Suggestion:

        scrollbar.repaint(getTrackBounds());

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

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


More information about the client-libs-dev mailing list