RFR: 8340344: The first item in TreeView is not aligned in the beginning

Andy Goryachev angorya at openjdk.org
Wed May 7 15:40:31 UTC 2025


On Wed, 19 Feb 2025 16:45:54 GMT, Ziad El Midaoui <zelmidaoui at openjdk.org> wrote:

> The issue occurred because items preceding an item with children (items with a disclosure node) had different widths, which led to misalignment. This can be fixed by requesting a cell relayout whenever the disclosure node's width changes.

modules/javafx.controls/src/main/java/javafx/scene/control/skin/TreeCellSkin.java line 210:

> 208: 
> 209:         final double defaultDisclosureWidth = maxDisclosureWidthMap.containsKey(tree) ?
> 210:                 maxDisclosureWidthMap.get(tree) : 20;   // JDK-8119169: default width of default disclosure node

This is probably not a good solution: I think the root cause is not in that the default value is incorrect, but in that two different values are used in the same view (i.e. that it first uses the default value, then the value computed from the disclosure node, if I read the code correctly).

Could you please investigate?

I've linked the JBS ticket mentioned in the comment, take a look at the discussion there https://bugs.openjdk.org/browse/JDK-8119169 , especially the comment about variable width disclosure node.

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1715#discussion_r1962563133


More information about the openjfx-dev mailing list