RFR: 5108458: JTable does not properly layout its content [v11]
Alexey Ivanov
aivanov at openjdk.org
Thu Nov 30 17:47:20 UTC 2023
On Thu, 30 Nov 2023 17:03:00 GMT, Tejesh R <tr at openjdk.org> wrote:
>> src/java.desktop/share/classes/javax/swing/JTable.java line 9809:
>>
>>> 9807: }
>>> 9808: return super.getWidth();
>>> 9809: }
>>
>> Can you elaborate on why it's needed? Presumably both versions return the same width because `JTable` doesn't override `getWidth`.
>
> I actually reused it from `JTableHeader` class and yeah it will be `parent.getWidth ` always as of now, but I thought it might be for future purpose, but not sure... Should we retain or just use `parent.getWidth` directly?
You don't call `parent.getWidth()` here, you always call `this.getWidth()`.
I don't know why `JTableHeader` has special handling for it… Yet in the case of `JTableHeader` it may be reasonable: the header follows the table width if it's auto-resizable. I presume the table handles this mode somehow.
> I thought it might be for future purpose, but not sure... Should we retain or just use `parent.getWidth` directly?
In both cases, you call the same implementation of `getWidth`. I'm for removing the `getWidthInRightToLeft` method altogether unless there's a specific purpose for doing it, which I can't see — use `getWidth` directly.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16374#discussion_r1411060721
More information about the client-libs-dev
mailing list