RFR: 8234071: JTable.AUTO_RESIZE_LAST_COLUMN acts like AUTO_RESIZE_ALL_COLUMNS
Abhishek Kumar
abhiscxk at openjdk.org
Mon Jul 15 08:48:51 UTC 2024
On Wed, 10 Jul 2024 10:28:08 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:
> When a JTable is resized with` JTable.setAutoResizeMode` set to ` AUTO_RESIZE_LAST_COLUMN` then it behaves exactly as if I specified `AUTO_RESIZE_ALL_COLUMNS`.
> This is because when `JTable.doLayout` tries to resize the columns, it checks which column to resize by calling `getResizingColumn `and in absence of any column info, it resizes all, so during `setAutoResizeMode` the resizing column needs to be set, which is being done for AUTO_RESIZE_LAST_COLUMN in this fix.
> No regression test is provided as it can be easily checked with SwingSet2->JTable(demo)->Autoresize mode (set to "Last Column")
I have a doubt for auto resize property, similar behavior is holding true for `AUTO_RESIZE_NEXT_COLUMN` .
If the user set the mode to `AUTO_RESIZE_NEXT_COLUMN`, all columns are of same width and resized on expanding of container window. As per the spec ( `AUTO_RESIZE_NEXT_COLUMN: Use just the column after the resizing column. This results in the "boundary" or divider between adjacent cells being independently adjustable.`) only the next column should be resized not all the columns.
Is it the correct behavior ? If not, shouldn't `AUTO_RESIZE_NEXT_COLUMN` also needs to be handle along with `AUTO_RESIZE_LAST_COLUMN` ?
**or**
user implementation needs to be changed to handle this mode ?
_Otherwise current fix is working as expected for `AUTO_RESIZE_LAST_COLUMN`._
-------------
PR Comment: https://git.openjdk.org/jdk/pull/20107#issuecomment-2227988188
More information about the client-libs-dev
mailing list