Skip to content

Commit 902bada

Browse files
committed
8234071: JTable.AUTO_RESIZE_LAST_COLUMN acts like AUTO_RESIZE_ALL_COLUMNS
Reviewed-by: prr, abhiscxk
1 parent 1b9270a commit 902bada

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/java.desktop/share/classes/javax/swing/JTable.java

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -1266,6 +1266,12 @@ public void setAutoResizeMode(int mode) {
12661266
autoResizeMode = mode;
12671267
resizeAndRepaint();
12681268
if (tableHeader != null) {
1269+
if (mode == JTable.AUTO_RESIZE_LAST_COLUMN) {
1270+
int colCnt = columnModel.getColumnCount();
1271+
if (colCnt > 0) {
1272+
tableHeader.setResizingColumn(columnModel.getColumn(colCnt - 1));
1273+
}
1274+
}
12691275
tableHeader.resizeAndRepaint();
12701276
}
12711277
firePropertyChange("autoResizeMode", old, autoResizeMode);

0 commit comments

Comments
 (0)