I'm creating a Java application with Swing as the GUI. I'm using FlatLaf themes FlatLightLaf
.
On the JMenuBar
I want to create something like this:
But I end up with something like this:
The problem is with the margins. I want to add space between the hover background and the actual background. To be clear I want the hover background to have a margin.
How can I achieve this?
I tried to use FlatLaf Theme Editor and this is how my FlatLaf.properties
file looks like:
MenuBar.itemMargins = 10, 10, 10, 10
MenuBar.selectionArc = 20
But it didn't work. It just made the tab sizes bigger instead of adding space around it.
Okay i figured it out. I should have used MenuBar.selectionInsets
along with MenuBar.itemMargins
. So the FlatLaf.properties
file now looks like this:
MenuBar.itemMargins = 10, 15, 10, 15
MenuBar.selectionArc = 20
MenuBar.selectionInsets = 5, 5, 5, 5