Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Menus: improved usability of submenus #490

Merged
merged 1 commit into from
Mar 13, 2022
Merged

Menus: improved usability of submenus #490

merged 1 commit into from
Mar 13, 2022

Conversation

DevCharly
Copy link
Collaborator

This PR improves the usability of submenus (see issue #247).
It makes it much easier to move the mouse into a submenu without the risk that the submenu is hidden.

Without this PR, you have to move the mouse on the red path, otherwise the submenu will be hidden.
With this PR, you can move the mouse on the green path, over other menu items.

grafik

The implementation uses a safe triangle, described in this article.
When you move the mouse within the safe triangle toward the submenu, it stays open.

grafik

Demo:

submenu-usability

To see the safe triangle in your application (for testing) use:

UIManager.put( "FlatLaf.debug.menu.showSafeTriangle", true );

To disable this feature use:

UIManager.put( "Menu.useSafeTriangle", false );

Note: This feature temporary installs a custom AWT event queue (java.awt.EventQueue) while the safe triangle active (as shown in above video). If you also use a custom event queue in your application (a subclass of java.awt.EventQueue), test whether this PR raise any issues.

@DevCharly DevCharly merged commit d006ac2 into main Mar 13, 2022
@DevCharly DevCharly deleted the submenu-usability branch March 13, 2022 22:49
DevCharly added a commit that referenced this pull request Mar 14, 2022
…ng on the screen to determine its location` when submenu is empty (PR #490; issue #247)
DevCharly added a commit that referenced this pull request Jul 13, 2022
…times, which can freeze the application caused pushing multiple event queues and popping wrong event queue first

(e.g. NetBeans Form Editor invokes `FlatLaf.initialize()` but not `uninitialize()`)

(PR #490; apache/netbeans#4231)
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.

Improving the user friendliness of context menus by closing them less agressively
1 participant