On Wed, 16 Jul 2025 06:12:11 GMT, Abhishek Kumar <abhis...@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

Reply via email to