RFR: 8375573: JTable ignores setPreferredWidth during initial layout when AUTO_RESIZE_LAST_COLUMN is enabled
Tejesh R
tr at openjdk.org
Thu Jan 22 10:28:34 UTC 2026
On Mon, 19 Jan 2026 02:18:06 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:
> AUTO_RESIZE_LAST_COLUMN handling was done in [JDK-8234071](https://bugs.openjdk.org/browse/JDK-8234071) but it didn't honour the preferred width if it is already been set for each column so when layouting is done, it only sees the `resizingColumn`
> is set to AUTO_RESIZE_LAST_COLUMN and adjust only the last column and distribute width equally to all other column.
>
> Fix is made to honour the user-set preferred column width even if auto-resize mode is set to LAST_COLUMN
src/java.desktop/share/classes/javax/swing/JTable.java line 3206:
> 3204: if (columnModel.getColumn(i).getPreferredWidth() != 75
> 3205: && columnModel.getColumn(i).getWidth() == 75) {
> 3206: prefWidthSet = true;
Can break the loop for first true condition instead of iterating through all the columns ?
test/jdk/javax/swing/JTable/TestJTableColWidth.java line 81:
> 79: }
> 80: } finally {
> 81: if (frame != null) {
Normally we do this inside EDT.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/29291#discussion_r2716258542
PR Review Comment: https://git.openjdk.org/jdk/pull/29291#discussion_r2716261586
More information about the client-libs-dev
mailing list