Closed MerlinUKRhapsody closed 4 months ago
Wouldn't that be what you're looking for?
Of course I've set that :) Its set to white Problem is there is no MenuBar.foregroundInactive (or similar). So while I can have two different backgrounds depending on wether the form is active or not - i cant do the same for menubar so i have to choose one color which looks good on either a dark or a light background - I would like to change the menubar color to be black if the window is active so it looks better on the orange - or white if the window is inactive so it looks better on the blue
Then just add a WindowListener
to your frame and call yourMenuBar.setForeground()
in the windowActivated
and windowDeactivated
methods.
stackoverflow.com and ChatGPT also know a lot about this stuff.
Ah yes I hadn't thought of that. I do use ChatGPT daily and I do perform exhaustive searching and experimentation to try and solve issues on my own before bothering you guys with questions ! I invented a new UIManager property 'MenuBar.inactiveForeground' and added a Window listener to grab the preferred colors on activation / deactivation of the owning window and apply them manually to the menu bar. It would be great if FlatLaf did this natively - after all thats why I'm using a theme so I don't have to manually apply colors but its solved my issue anyway so thanks !
If I embed the menu bar into the window - how do i change the color of the menu bar text when the window is inactive ? For example - An Inactive window has a blue background and white title text:
An active window has an orange background and black title text - but I cant seem to change the menu text color and the white which looks great on the inactive window doesnt look so great now: