[jdk8u-dev] RFR: 8074883: Tab key should move to focused button in a button group
ktakakuri
duke at openjdk.org
Mon Dec 19 01:41:33 UTC 2022
This is a backport of JDK-8074883: Tab key should move to focused button in a button group.
I would like to backport the patch to OpenJDK8u.
Original patch does not apply cleanly to 8u, because the fix uses a new API published in JDK9.
* Since RequestFocusController only determines whether or not to set focus, I modified it so that requestFocus/requestFocusInWindow is called by SwingUtilities.invokeLater() and re-set focus and return false.
Without invokeLater(), the focus returns to the first button in case of Cause.ACTIVATION.
* ToggleButton.getGroupSelection() is defined as a package private method, because it must be called by JCompoennt.focusController.
* Calling requestFocus()/requestFocusInWindow() will be processed as Cause.UNKNOWN.
ToggleButton.getGroupSelection() returns itself, so no circular call occurs.
* I moved Component.requestFocusController.acceptRequestFocus because RequestFocusContoroller is not called when Cause.ACTIVATION.
* Only Swing components replace default RequestFocusController to JComponent.focusController.
The focusController returns true except for Swing, so this change does not affect other components.
Testing:
build on Windows x86_64
java/awt, javax/swing and ButtonGroupFocusTest.java on Windows x86_64
-------------
Commit messages:
- Merge branch 'openjdk:master' into 8074883
- Merge branch 'openjdk:master' into 8074883
- Backport eef0714323de
Changes: https://git.openjdk.org/jdk8u-dev/pull/212/files
Webrev: https://webrevs.openjdk.org/?repo=jdk8u-dev&pr=212&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8074883
Stats: 190 lines in 4 files changed: 181 ins; 9 del; 0 mod
Patch: https://git.openjdk.org/jdk8u-dev/pull/212.diff
Fetch: git fetch https://git.openjdk.org/jdk8u-dev pull/212/head:pull/212
PR: https://git.openjdk.org/jdk8u-dev/pull/212
More information about the jdk8u-dev
mailing list