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

Prasanta Sadhukhan psadhukhan at openjdk.org
Thu Nov 13 05:22:40 UTC 2025


> `JTree.updateUI` calculate item sizes from the cell renderer, but it doesn't call `updateUI `on the cell renderer until afterwards. This leads to incorrect size calculation, which is observed when we switch from one L&F to another where it is seen that all tree items are slightly too cramped, with too little space between rows and text are abbreviated.
> Fix is to ensure `JTree.updateUI` update the cell renderer before updating the UI. 
> CI testing is ok..
> 
> Before fix
> <img width="142" height="146" alt="image" src="https://github.com/user-attachments/assets/95d43e47-122a-4ca4-8a3f-f4bf5c1d3f43" />
> 
> After fix
> <img width="145" height="125" alt="image" src="https://github.com/user-attachments/assets/068b5988-119c-4b99-be27-1ef5d52a28a2" />

Prasanta Sadhukhan has updated the pull request incrementally with one additional commit since the last revision:

  Test formatting

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/28258/files
  - new: https://git.openjdk.org/jdk/pull/28258/files/522159b1..a11aa575

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=28258&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=28258&range=00-01

  Stats: 13 lines in 1 file changed: 0 ins; 4 del; 9 mod
  Patch: https://git.openjdk.org/jdk/pull/28258.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/28258/head:pull/28258

PR: https://git.openjdk.org/jdk/pull/28258


More information about the client-libs-dev mailing list