JavaFX - How to create a thin MenuBar?

I placed at the top of BorderPanea MenuBarwith the File and Close menus MenuIteminside:

Thick line

How can I make it look thinner than MenuBarmost of the software used, similar to the image below?

Thick line

I think it should be simple enough, but as a beginner, I could not do it. I am not sure what to name the problem (not many useful results for "javafx menubar height", size, style, etc.)

+4
source share
1 answer

Adding the following styles to the stylesheet reduces the height of each menu item:

.menu-item { -fx-padding: 1 5 1 5; }
.menu { -fx-padding: 1 5 1 5; }

enter image description here

, :

.menu .context-menu { -fx-padding: 1 1 1 1; }

enter image description here

:

.menu-item >.label {-fx-font-size:9;}
.menu >.label {-fx-font-size:9;}

enter image description here

, MenuBar :

.menu-bar {
  -fx-padding: 0 1 0 1;
  -fx-spacing: 1;
};

enter image description here

+5

Source: https://habr.com/ru/post/1675699/


All Articles