RFR: 8042054: JTree.updateUI uses out-of-date item size information [v2]

Prasanta Sadhukhan psadhukhan at openjdk.org
Thu Nov 27 03:01:48 UTC 2025


On Thu, 27 Nov 2025 01:55:34 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:

>> Since this is similar to JTable where issue is not seen and the cellrenderer and editors are used, I guess we should follow the same approach as it is being done in JTable as below and set the renderers and editors before the UI..
>> 
>> https://github.com/openjdk/jdk/blob/49176e322bbb9ed1ef2f534b949b937770b54162/src/java.desktop/share/classes/javax/swing/JTable.java#L3697-L3727
>> 
>> Other which does not use this renderers and editors we can skip setting UI after for the timebeing..
>
> I see, please double check how the setUI() of "jtree vs jtable" are implemented, are they the same? also do we need to call something similar to configureEnclosingScrollPaneUI() in jtree? is the order is the only difference between the two?

It's almost the same, JTable setUI calls an extra repaint [which is part of JTable.setUI spec too) which I am not sure is necessary for JTree for which we have [treeDidChange](https://docs.oracle.com/en/java/javase/24/docs/api/java.desktop/javax/swing/JTree.html#treeDidChange())()]
Regarding `configureEnclosingScrollPaneUI`, it's not needed as it is used to cater to the scrollPane with JTable feature 
https://docs.oracle.com/en/java/javase/24/docs/api/java.desktop/javax/swing/JTable.html#createScrollPaneForTable(javax.swing.JTable)
which is not present for JTree

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

PR Review Comment: https://git.openjdk.org/jdk/pull/28258#discussion_r2567026460


More information about the client-libs-dev mailing list