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.

Prasanta Sadhukhan psadhukhan at openjdk.org
Thu Jun 22 14:01:31 UTC 2023


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.

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

Commit messages:
 - Test fix
 - 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.
 - Merge branch 'master' of github.com:prsadhuk/jdk
 - Merge remote-tracking branch 'upstream/master'
 - Merge remote-tracking branch 'upstream/master'
 - Revert "Fix"
 - Fix

Changes: https://git.openjdk.org/jdk/pull/14614/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14614&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8166900
  Stats: 105 lines in 2 files changed: 104 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/14614.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/14614/head:pull/14614

PR: https://git.openjdk.org/jdk/pull/14614



More information about the client-libs-dev mailing list