RFR: 6967482: TAB-key does not work in JTables after selecting details-view in JFileChooser [v2]
Tejesh R
tr at openjdk.org
Tue Jun 18 05:16:12 UTC 2024
On Mon, 17 Jun 2024 19:58:37 GMT, Phil Race <prr at openjdk.org> wrote:
>> Tejesh R has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Review fix - remove null initialization for table
>
> src/java.desktop/share/classes/sun/swing/FilePane.java line 1320:
>
>> 1318: }
>> 1319:
>> 1320: detailsTable.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS,
>
> If I have this right, JTable gets the map initialised via this code in BasicTableUI.java
>
> InputMap getInputMap(int condition) {
> if (condition == JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT) {
> InputMap keyMap =
> (InputMap)DefaultLookup.get(table, this,
> "Table.ancestorInputMap");
> InputMap rtlKeyMap;
>
> if (table.getComponentOrientation().isLeftToRight() ||
> ((rtlKeyMap = (InputMap)DefaultLookup.get(table, this,
> "Table.ancestorInputMap.RightToLeft")) == null)) {
> return keyMap;
> } else {
> rtlKeyMap.setParent(keyMap);
> return rtlKeyMap;
> }
> }
> return null;
> }
>
> This uses the shared defaults for the L&F.
> I imagine that sharing is by far the most efficient thing to do for 99% of uses, in which case I expect that somewhere there's some doc telling apps that if they mess with the map for a component, they need to make a copy first ? But how to do that ? And the author of the code above that modified the shared map presumably was ignorant of this.
Yes, modifying the shared `ActionMap` is causing this issue though. As far as I have seen the copy first solution is mentioned in this bug https://bugs.openjdk.org/browse/JDK-8166352 as customer submitted workaround.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/19725#discussion_r1643800858
More information about the client-libs-dev
mailing list