On Thu, 17 Jul 2025 11:12:56 GMT, Abhishek Kumar <abhis...@openjdk.org> wrote:

>> test/jdk/javax/swing/JMenuBar/TestMenuMnemonicLinuxAndMac.java line 120:
>> 
>>> 118:         frame.setVisible(true);
>>> 119:         frame.toFront();
>>> 120:         frame.requestFocus();
>> 
>> If you are particular about focus being gained before the test starts, maybe 
>> you can use `CountDownLatch `and have FocusListener for frame and  wait till 
>> timeout and  release the latch in `focusGained`
>
> `CountDownlatch` should be used along with` requestFocus` ?
> Otherwise, I think the test may timeout because if we remove these two 
> statements, frame may not have focus.

Yes as the requestFocus spec says "Developers must never assume that this 
Component is the focus owner until this Component receives a FOCUS_GAINED event"
but I guess the present change is good enough for now since there is robot 
delay and all..

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

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

Reply via email to