RFR: 5108458: JTable does not properly layout its content [v5]
Tejesh R
tr at openjdk.org
Tue Nov 21 04:56:10 UTC 2023
On Mon, 20 Nov 2023 16:06:18 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:
>> Tejesh R has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Review fix
>
> src/java.desktop/share/classes/javax/swing/plaf/synth/SynthTableUI.java line 855:
>
>> 853: }
>> 854: }
>> 855: private int getXPosition(int column) {
>
> This method is exactly the same as in `BasicTableUI`, if I don't miss anything.
>
> You should rather move this to a utility class which is accessible to both `-UI` classes. Even more: if you're following the same code path that's implemented for `JTableHeader`, you should consider re-using the code from the header painting too… by extracting the relevant parts to a utility class if appropriate.
>
> If another bug is found, it will need to be fixed in *one place* instead of several places which repeat the same code.
The methods can be both moved to Utility class for sure, but not sure of re-using the code from `JTableHeader` coz `getColumnModel()` and `getWidthInRightToLeft()` are specific to it.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16374#discussion_r1400026457
More information about the client-libs-dev
mailing list