Closed rkeen-siemens closed 2 years ago
Yes, it is possible in latest 2.5-SNAPSHOT
: https://github.com/JFormDesigner/FlatLaf#snapshots
There are two new UI properties MenuBar.selectionBackground
and MenuBar.selectionForeground
that are used for top level menus (JMenu
components in JMenuBar
). See also https://www.formdev.com/flatlaf/components/menubar/
Usage (for all menu bars):
UIManager.put( "MenuBar.selectionBackground", Color.green );
UIManager.put( "MenuBar.selectionForeground", Color.red );
Styling is also supported (for single menu bar):
menuBar.putClientProperty( "FlatLaf.style", "selectionBackground: #0f0; selectionForeground: #f00" );
When customizing menu colors, you can change the selection color for a menu via
Menu.selectionBackground
and for a menu item viaMenuItem.selectionBackground
. However, it appears thatMenu.selectionBackground
applies to both the top level menu (e.g. JMenu in the menu bar) and any submenus (e.g. JMenu > JMenu in the drop down menu) as shown below.Is it possible to have a different color for top level menus and submenus? Or is there a way to have submenus use the menu item colors?