RFR: 8338282: javax/swing/JMenuBar/TestMenuMnemonicLinuxAndMac.java test failed on macOS and Ubuntu [v2]

Tejesh R tr at openjdk.org
Wed Jul 16 06:25:29 UTC 2025


On Wed, 16 Jul 2025 06:12:11 GMT, Abhishek Kumar <abhiscxk at openjdk.org> wrote:

>> test/jdk/javax/swing/JMenuBar/TestMenuMnemonicLinuxAndMac.java line 120:
>> 
>>> 118:         frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
>>> 119:         frame.setVisible(true);
>>> 120:         frame.toFront();
>> 
>> ` frame.toFront();` is required ? Did you try only with `frame.requestFocus();` ?
>
> `frame.requestFocus()` tries to make the frame current focus owner but it does not guarantee that focus will be granted. So, to be on safer side, it's better to bring the frame to the front and the request keyboard focus.

According to me, `frame.requestFocus()` should work fine for this test. Can u test once without `frame.toFront();` and see if its fine ?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26307#discussion_r2209372265


More information about the client-libs-dev mailing list