Skip to content

Conversation

@frigoref
Copy link
Member

No description provided.

@frigoref
Copy link
Member Author

@DanVanAtta: I would be targeting for the following and would like you to recheck this approach before I continue.

  1. Separate mnemonics (menu navigation started with (Alt) from shortcuts (global/local)
  2. Menu items should use KeyEvent wrapped local enum Mnemonics of the class containing the menu instead of KeyCode/KeyStroke.
  3. Each menu level might have its own local enum Mnemonics to allow uniqueness per level.
  4. KeyCode should be used for shortcuts (global and local).
  5. KeyCode constants should be renamed to indicate the usage rather then the key combination to avoid reusing the same global shortcut (which lead to issue JMenuItemBuilder: Replace constructor parameter KeyCode with int (mnemonic) #13944 ).

We might want to check together some specifics as well.

@DanVanAtta DanVanAtta self-requested a review December 14, 2025 18:51
@DanVanAtta DanVanAtta removed their assignment Dec 14, 2025
EXPORT_CHARTS_UNIT(KeyEvent.VK_U),
EXPORT_CHARTS_SETUP(KeyEvent.VK_C);

private final int mnemonicCode;
Copy link
Member

@DanVanAtta DanVanAtta Dec 14, 2025

Choose a reason for hiding this comment

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

private final int mnemonicCode;

Why not store this as a KeyCode?

KeyCode is meant to be a type-safe wrapper around KeyEvent.VK_...
The purpose of swingbuilders is to produce type-safe APIs. Which is to say, to get away from using things like int to map to keycodes.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants