On Thu, 27 Nov 2025 09:53:21 GMT, Prasanta Sadhukhan <[email protected]> 
wrote:

> 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..

This pull request has now been integrated.

Changeset: 5edeb71e
Author:    Prasanta Sadhukhan <[email protected]>
URL:       
https://git.openjdk.org/jdk/commit/5edeb71e3b148d52962c46180c92ebfeda018f67
Stats:     66 lines in 2 files changed: 64 ins; 2 del; 0 mod

6292135: DefaultTableModel.setColumnIdentifiers() Clears JTable Row Heights

Reviewed-by: tr, kizune

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

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

Reply via email to