Skip to content

Conversation

@DamonGuy
Copy link
Contributor

@DamonGuy DamonGuy commented Sep 18, 2025

When looking into this, it looks like macOS does not support mnemonics. It would therefore make sense to exclude macOS from this test as its main purpose is to test mnemonics on JTabbedPanes. Updated the test header to exclude macOS and test's keyPresses to remove the macOS specific inputs.

https://discussions.apple.com/thread/7983221?sortBy=rank


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8064922: [macos] Test javax/swing/JTabbedPane/4624207/bug4624207.java fails (Bug - P4)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/27371/head:pull/27371
$ git checkout pull/27371

Update a local copy of the PR:
$ git checkout pull/27371
$ git pull https://git.openjdk.org/jdk.git pull/27371/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 27371

View PR using the GUI difftool:
$ git pr show -t 27371

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/27371.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Sep 18, 2025

👋 Welcome back dnguyen! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Sep 18, 2025

@DamonGuy This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8064922: [macos] Test javax/swing/JTabbedPane/4624207/bug4624207.java fails

Reviewed-by: tr, honkar, psadhukhan

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 543 new commits pushed to the master branch:

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk
Copy link

openjdk bot commented Sep 18, 2025

@DamonGuy The following label will be automatically applied to this pull request:

  • client

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added client client-libs-dev@openjdk.org rfr Pull request is ready for review labels Sep 18, 2025
@mlbridge
Copy link

mlbridge bot commented Sep 18, 2025

Webrevs

}
robot.keyPress(KeyEvent.VK_ALT);
robot.keyPress(KeyEvent.VK_B);
robot.keyRelease(KeyEvent.VK_ALT);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keyRelease should be other way around...ie VK_B first and then VK_ALT

Copy link
Contributor

@prsadhuk prsadhuk Sep 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also you may want to check another test EditableFocusTest which also sets mnemonic "B" on a JButton and it passes in macOS..One difference is it uses setMnemonic(char) instead of setMnemonic(int)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I reversed the order of the release.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also you may want to check another test EditableFocusTest which also sets mnemonic "B" on a JButton and it passes in macOS..One difference is it uses setMnemonic(char) instead of setMnemonic(int)

I see that test's setMnemonic. This tabbedPane's API is forced to use setMnemonicAt(int, int). I figured, since mnemonics don't seem to be supported on macOS anyway, it does not really make sense to ProblemList this test for macOS only, and instead just exclude macOS from the test since the test fails with the current implementation using setMnemonicAt.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not macOS but Aqua L&F problem it seems...
javax/swing/JTabbedPane/8134116/Bug8134116.java also uses setMnemonicAt but it uses Nimbus and it seems to pass on macOS as per CI
but I guess its ok to restrict as native macOS where it doesn't seem to work will run on its own Aqua L&F kind of interface

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even with Nimbus LaF javax/swing/JTabbedPane/8134116/Bug8134116.java the mnemonic is set as VK_Z for tab "zero" and though 'z' is underlined it does not respond to the keypress. Looks like it does not work completely in Nimbus LaF too.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Sep 24, 2025
@mrserb
Copy link
Member

mrserb commented Sep 24, 2025

Have you tried disabling the global menu on macOS and testing the mnemonics when the menu is embedded into the frame? Does it work?

@openjdk
Copy link

openjdk bot commented Sep 25, 2025

⚠️ @DamonGuy This pull request contains merges that bring in commits not present in the target repository. Since this is not a "merge style" pull request, these changes will be squashed when this pull request in integrated. If this is your intention, then please ignore this message. If you want to preserve the commit structure, you must change the title of this pull request to Merge <project>:<branch> where <project> is the name of another project in the OpenJDK organization (for example Merge jdk:master).

@openjdk openjdk bot removed the ready Pull request is ready to be integrated label Sep 25, 2025
@openjdk openjdk bot added the ready Pull request is ready to be integrated label Sep 26, 2025
@DamonGuy DamonGuy requested a review from prsadhuk September 26, 2025 21:13
@DamonGuy
Copy link
Contributor Author

@prsadhuk Could you take another look at this?

@honkar-jdk
Copy link
Contributor

honkar-jdk commented Oct 2, 2025

@DamonGuy

When looking into this, it looks like macOS does not support mnemonics. It would therefore make sense to exclude macOS from this test

When I tested menu mnemonics on macOS ScreenMenuBar it works as expected.

May be try @mrserb suggestion by using System.setProperty("apple.laf.useScreenMenuBar", "false"); and verify if mnemonics work for embedded frame menu and not for JTabbedPane. If it works for embedded frame menu then should the test be de-problemlisted as it could indicate a product bug or feature not implemented yet?

Have you tried disabling the global menu on macOS and testing the mnemonics when the menu is embedded into the frame? Does it work?

@DamonGuy
Copy link
Contributor Author

DamonGuy commented Oct 7, 2025

May be try @mrserb suggestion by using System.setProperty("apple.laf.useScreenMenuBar", "false"); and verify if mnemonics work for embedded frame menu and not for JTabbedPane.

It does not seem to make a difference in my testing. The test still fails the same way. Did you add any other changes in your testing when it passed for you?

@honkar-jdk
Copy link
Contributor

honkar-jdk commented Oct 8, 2025

It does not seem to make a difference in my testing. The test still fails the same way. Did you add any other changes in your testing when it passed for you?

I tested the Apple screen bar mnemonics on Finder and IntelliJ IDE application. They worked fine. (I tested the native behavior and suggested to double-check the mnemonics behavior for Frame menu)

The suggestion was to verify adding menu bar to the Frame and then test it by setting the "apple.laf.useScreenMenuBar" to true and false to see if the mnemonics works in both cases.

@DamonGuy
Copy link
Contributor Author

It does not seem to make a difference in my testing. The test still fails the same way. Did you add any other changes in your testing when it passed for you?

I tested the Apple screen bar mnemonics on Finder and IntelliJ IDE application. They worked fine. (I tested the native behavior and suggested to double-check the mnemonics behavior for Frame menu)

The suggestion was to verify adding menu bar to the Frame and then test it by setting the "apple.laf.useScreenMenuBar" to true and false to see if the mnemonics works in both cases.

I have manually added a JMenuBar to the frame in bug4624207.java and ran the test with both "apple.laf.useScreenMenuBar" set to true/false. In both cases, the test still fails.

I have looked further into whether macOS officially supports mnemonics, and there are a few occurrences (as you've given examples of some) where mnemonics work, but there seems to be no official documentation that I can find that confirms that this is supported. As such, I believe this change can continue as-is for now.

@prsadhuk
Copy link
Contributor

prsadhuk commented Oct 22, 2025

I guess the testing should not be about mnemonics which does pass in macos as can be seen in this comment but rather mnemonicsAt which is tabbed pane specific and I dont know if we have any precedent of this support in native app

@honkar-jdk
Copy link
Contributor

@prsadhuk

I guess the testing should not be about mnemonics which does pass in macos as can be seen in #27371 (comment) but rather mnemonicsAt which is tabbed pane specific and I dont know if we have any precedent of this support in native app

Right, but the post https://discussions.apple.com/thread/7983221?sortBy=rank discusses about general menu mnemonics and quite old post (filed in 2017). Now the menu mnemonics seem to work (native and IntelliJ app), thus wanted to verify if it is the case that mnemonics works frame menu and not for tab mnemonics.

@DamonGuy
Copy link
Contributor Author

/integrate

@openjdk
Copy link

openjdk bot commented Oct 22, 2025

Going to push as commit be18e7e.
Since your change was applied there have been 548 commits pushed to the master branch:

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Oct 22, 2025
@openjdk openjdk bot closed this Oct 22, 2025
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Oct 22, 2025
@openjdk
Copy link

openjdk bot commented Oct 22, 2025

@DamonGuy Pushed as commit be18e7e.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

client client-libs-dev@openjdk.org integrated Pull request has been integrated

Development

Successfully merging this pull request may close these issues.

5 participants