Skip to content

Selection artifacts in JTree/JScrollPane under Windows 11/FlatLaf 3.5.4 with fractional scaling (125%) #1022

@chochmuthsupplyet

Description

@chochmuthsupplyet

Setup: I have a JTree within a JScrollPane. FlatLaf is set up to show a full-width selection. Execution environment is JDK 21 (Adoptium, Temurin) on Windows 11 (in UTM on mac, all updates installed) with fractional scaling (125%). FlatLaf version is 3.5.4.

Issue: On selection changes, the last column of the selection rectangle sometimes remains at the old selection row. At the same time, the last pixel column is missing at the new selection row. This leads to visible artifacts when changing selection.

Observations: The clipping rectangle of the JTree is set one pixel in width too small, yet the selection rectangle is filled across the entire width. Hence, any repaint has no effect on these trailing pixels, since they are outside of the clipping rectangle.

Workaround: My current fix is to use rounded selection borders with non-zero insets and forcing JTree to never scroll horizontally while truncating text when width is too small. This avoids the selection bleeding into the border, but it is not a solution for all my JTrees.

Any update to this issue is welcome. Many thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions