On Thu, 29 Feb 2024 07:48:09 GMT, Abhishek Kumar <abhis...@openjdk.org> wrote:
>> Menu mnemonic doesn't toggle between show and hide state when F10 is >> pressed. Behavior is not similar to windows native application. Fix is to >> ensure that menu mnemonic state toggles between show and hide. >> >> Can be verified with SwingSet2 application. >> CI tests are green with the fix. Link posted in JBS. > > Abhishek Kumar has updated the pull request incrementally with one additional > commit since the last revision: > > Review comment update > > > You could add @modules java.desktop/com.sun.java.swing.plaf.windows to > > > jtreg tags and access the > > > com.sun.java.swing.plaf.windows.WindowsLookAndFeel.isMnemonicHidden > > > method to verify that the mnemonics are shown or hidden based on how many > > > times you (the Robot) pressed F10 key as well as the menu bar is active > > > or not. > > > > > > How to check for menubar whether it is active or not? Should I check the > > keyboard focus? > > You have it in the code: > > ```java > MenuElement[] selectedPath = msm.getSelectedPath(); > if (selectedPath.length == 0) { > throw new RuntimeException(); > } > if (selectedPath[0] != menuBar || selectedPath[1] != fileMenu) > { > throw new RuntimeException(); > } > ``` > > where menuBar is the `JMenuBar` that you created in the test and `fileMenu` > is the first `JMenu` in the menu bar. Added the test case. ------------- PR Comment: https://git.openjdk.org/jdk/pull/17961#issuecomment-1973029404