RFR: 8166900: If you wrap a JTable in a JLayer, the cursor is moved to the last row of table by you press the page down key. [v2]

Damon Nguyen dnguyen at openjdk.org
Thu Jul 6 05:13:07 UTC 2023


On Fri, 23 Jun 2023 03:14:21 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:

>> If a JTable is wrapped in JLayer and first row is selected and VK_PAGE_DOWN is pressed, the last row of the table is selected instead of the next row after current viewport.
>> This is because table.getParent.getSize() returns the whole table size 
>> whereas it should be the JViewport which size should be used to calculate the "delta" to be used to scroll the table and select the row and "SwingUtilities.getUnwrappedParent(table)" gets the viewport.
>> 
>> Tested against SwingSet2 too where it worked too.
>
> Prasanta Sadhukhan has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Formatting

Marked as reviewed by dnguyen (Committer).

test/jdk/javax/swing/JTable/JLayerTableTest.java line 75:

> 73:             SwingUtilities.invokeAndWait(() -> {
> 74:                 createUI();
> 75:             });

Is it better to call "SwingUtilities.invokeAndWait(JLayerTableTest::createUI());" since there's only 1 line in the block?

Tested and confirmed the changes make the test pass.

-------------

PR Review: https://git.openjdk.org/jdk/pull/14614#pullrequestreview-1515761355
PR Review Comment: https://git.openjdk.org/jdk/pull/14614#discussion_r1253936488



More information about the client-libs-dev mailing list