JFormDesigner / FlatLaf

FlatLaf - Swing Look and Feel (with Darcula/IntelliJ themes support)
https://www.formdev.com/flatlaf/
Apache License 2.0
3.42k stars 272 forks source link

As of FlatLaf 1.3, clicking a JMenuItem(Action) while pressing a modifier key like SHIFT or CTRL has no special effect #371

Closed hshafie closed 3 years ago

hshafie commented 3 years ago

Hello,

As of FlatLaf 1.3, clicking a JMenuItem(Action) while pressing a modifier key like SHIFT or CTRL has no special effect. I mean: ActionEvent.getModifiers() always returns 0.

See attached Test.java. Test.java.gz

Compile it using: javac -cp "flatlaf-1.5.jar:." Test.java

Run it using: java -cp "flatlaf-1.5.jar:." Test

Run it with default LaF using: java -cp "flatlaf-1.5.jar:." Test -noflatlaf

Additional info:

Thank you for your beautiful LAF!

DevCharly commented 3 years ago

Can reproduce it. Occurs only with heavy-weight popups (default on Linux and macOS; on Windows only for large popups that do not fit into the window).

This line is responsible: https://github.com/JFormDesigner/FlatLaf/blob/1df9597bb17c739e034e486681a2146b7b79c390/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatRootPaneUI.java#L161

Added in commit 7b248427f00fdc7a77652e60ace058fe006a4288 for FlatLaf 1.3

But have no idea why adding an hierarchy listener has this effect...

hshafie commented 3 years ago

Thank you very much. Your help is much appreciated!

DevCharly commented 3 years ago

Fixed in main branch.

https://github.com/JFormDesigner/FlatLaf#snapshots

hshafie commented 3 years ago

Wow, not an easy fix! Thank you so much!