On Thu, 6 Aug 2026 03:28:22 GMT, Prasanta Sadhukhan <[email protected]>
wrote:
>> src/java.desktop/share/classes/javax/swing/JTable.java line 3282:
>>
>>> 3280: for (int i = 0; i < columnModel.getColumnCount(); i++) {
>>> 3281: TableColumn column = columnModel.getColumn(i);
>>> 3282: if (column.getPreferredWidth() != 75 && column.getWidth()
>>> == 75) {
>>
>> magic constant warning: testing for unrelated condition that might fail. I
>> think you need to consider a different criteria.
>
> it is needed because it is JTable/TableColumn’s default width and there's no
> constant for it as of now
> It was already discussed in
> https://github.com/openjdk/jdk/pull/29291#discussion_r2711110938
my point is that this condition might happen after initialization - the user
could, in theory, set all the columns to width 75 manually or programmatically.
what would happen in that case?
additionally, what would happen if the column model gets changed with the
column widths just so this method fails to detect the initial scenario?
would it be better to simply introduce a boolean flag (and possibly reset it
when model is changed, and possibly in other scenarios)?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/31704#discussion_r3729882777