**Problem:** The `javax/swing/JRadioButton/ButtonGroupFocus/ButtonGroupFocusTest.java` test fails in CI on Linux.
The focus is on _Button 2_ instead of _Button 4_. **Root cause:** The additional logging revealed, an expected `KEY_PRESS` event. The test uses `Robot` API to press the <kbd>Tab</kbd> key and release it. When the test fails, there are two `KEY_PRESS` events followed by a single `KEY_RELEASE` event. Because the <kbd>Tab</kbd> key is pressed twice, the focus moves twice: from _Button 2_ (the initial state) to _Button 4_ and then back to _Button 2_. **Fix:** Use `CountDownLatch`es to track whether a radio button received focus. Detect the case where two `KEY_PRESS` events moved focus to _Button 2_ and report the failure. Log focus movements and dispatched key events to facilitate failure analysis. Take a screenshot of the test frame in case of failure. These CI hosts seem to be quite slow, removing the delay added by `robot.setAutoDelay(100)` has reduced the number of unexpected `KEY_PRESS` events. This didn't affect Windows or macOS. ------------- Commit messages: - Log only focusOwner properties to reduce the noise in the test log - Increase focus timeout and remove delay between generating events - Detect spurious KEY_PRESS event and report an error - Rework JRadioButton/ButtonGroupFocusTest.java Changes: https://git.openjdk.org/jdk/pull/22977/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=22977&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8346581 Stats: 135 lines in 1 file changed: 96 ins; 13 del; 26 mod Patch: https://git.openjdk.org/jdk/pull/22977.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/22977/head:pull/22977 PR: https://git.openjdk.org/jdk/pull/22977