I am using swingx
library, on Windows I am now moving towards using the Flatlaf light and dark look and feel on all platforms
This looks fine on MacOS, but on Windows the status bar looks like it did with Windows look and feel and doesn't look right.
It is because I'm using the swingx JXStatusBar
component and this has some look and feel enhancements including some Windows specific images used for the background
e.g. swingx\swingx-core\src\main\resources\org\jdesktop\swingx\plaf\windows\resources\silver-statusbar-left.png
Trying to change the background colour of the component or the labels I add to it has no effect.
So I thought the best thing to do was move away from using JXStatusBar
and just use a JPanel, but continue adding the components in same way using JXStatusBar.Constraint
component = new JPanel();
.....
JXStatusBar.Constraint c1 = new JXStatusBar.Constraint();
c1.setFixedWidth(100);
component.add(statusLabel, c1);
JXStatusBar.Constraint c2 = new JXStatusBar.Constraint(JXStatusBar.Constraint.ResizeBehavior.FILL);
c2.setFixedWidth(200);
JXStatusBar.Constraint c4 = new JXStatusBar.Constraint(130);
component.add(filesLoadedLabel, c2);
component.add(filesFilteredLabel, c2);
component.add(tagBrowserFilterLabel, c2);
component.add(activeFiltersLabel, c2);
component.add(mbDelayLabel, c4);
component.add(memoryLabel, c4);
However as the screenshot above shows this doesnt work properly, probably because Im using the wrong LayoutManager but I cant work out what LayoutManager JXStatusBar is using I cannot see one defined in the code.
So my question is either:
Edit
Okay so I have got it basically working by hacking internal LayoutManager class from BasicStatusBarUI
but I think I would prefer to just use a standard LayoutManager, is that possible ?
Add flatlaf-swingx.jar
to your project, then JXStatusBar
works fine with FlatLaf:
See FlatLaf addon for SwingX and issue #492