RFR: 6292135: DefaultTableModel.setColumnIdentifiers() Clears JTable Row Heights [v2]
Prasanta Sadhukhan
psadhukhan at openjdk.org
Fri Dec 12 05:56:38 UTC 2025
> Calling `DefaultTableModel.setColumnIdentifiers()` resizes the row height of the table to default row height (16) even if the row height is changed to something other than the default using `JTable.setRowHeight(row, height).`
> The spec of `DefaultTableModel.setColumnIdentifiers()` https://docs.oracle.com/en/java/javase/24/docs/api/java.desktop/javax/swing/table/DefaultTableModel.html#setColumnIdentifiers(java.lang.Object[]) says that it
> `replaces the column identifiers in the model`, that is, the header field of the column is changed to the passed identifier and nowhere it is mentioned that row height would be changed.
>
> The issue happens because calling `DefaultTableModel.setColumnIdentifiers()` results in the firing of a `TableModelEvent` with HEADER_ROW event and JTable resets the `rowModel` for it irrespective of what the event is.
> Fix is to not reset the `rowModel` to keep the set rowHeight intact for HEADER_ROW event
>
> No other issue observed with CI with this fix..
Prasanta Sadhukhan has updated the pull request incrementally with one additional commit since the last revision:
Test headless
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/28529/files
- new: https://git.openjdk.org/jdk/pull/28529/files/e5b4f158..0e33270a
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=28529&range=01
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=28529&range=00-01
Stats: 51 lines in 1 file changed: 1 ins; 32 del; 18 mod
Patch: https://git.openjdk.org/jdk/pull/28529.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/28529/head:pull/28529
PR: https://git.openjdk.org/jdk/pull/28529
More information about the client-libs-dev
mailing list