RFR: 5108458: JTable does not properly layout its content [v6]
Tejesh R
tr at openjdk.org
Wed Nov 22 09:23:14 UTC 2023
On Tue, 21 Nov 2023 17:02:59 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:
>>> Does it mean that `table.getCellRect` returns an incorrect value in right-to-left case?
>>
>> Yes, it does! Clicking to select doesn't work correctly: wherever I click only the Salary column gets selected, there's no way to move selection to another cell (*visibly* at least), editing doesn't work either: if I select the Salary cell in the first row and press F2 to edit the value, the editor appears in the left top corner where the cell rendered before the fix.
>>
>> To enable editing, add
>>
>>
>> @Override
>> public boolean isCellEditable(int rowIndex, int columnIndex) {
>> return true;
>> }
>>
>>
>> to the `Model` class.
>
>> there's no way to move selection to another cell (_visibly_ at least)
>
> Yes, the selection moves but you can't see it. Moving the cell to editable state brings up the editor which is positioned like on [your screenshot above](https://github.com/openjdk/jdk/pull/16374#discussion_r1400007130) without the fix.
>
> It looks to me what you should actually change is the implementation of `JTable.getCellRect` so that returns the *correct* coordinates when the orientation is set to right-to-left and rendering will fix automatically.
Yeah, actually `JTable.getCellRect` can be changed/updated to handle this. Will work on it.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16374#discussion_r1401738490
More information about the client-libs-dev
mailing list