-
Bug
-
Resolution: Fixed
-
P4
-
8, 9
I noticed that when setting a menu button's content-display to graphic-only, the label padding still affects the layout of the button. Specifically, I noticed that the icon I wanted to show on the button was moved enough right to look out of center.
There may be a technical reason for this, but it sure is counter intuitive that when you explicitly state "graphic-only" you still have to set the -fx-padding of the label to 0. It is this sort of thing which makes JavaFX harder to learn.
Here is the styling I used
.my-button, .my-button:focused {
-fx-content-display: graphic-only;
}
This shows a MenuButton with my icon slightly moved right. To avoid that I added this css.
.my-button .label {
-fx-padding: 0;
}
which works.
There may be a technical reason for this, but it sure is counter intuitive that when you explicitly state "graphic-only" you still have to set the -fx-padding of the label to 0. It is this sort of thing which makes JavaFX harder to learn.
Here is the styling I used
.my-button, .my-button:focused {
-fx-content-display: graphic-only;
}
This shows a MenuButton with my icon slightly moved right. To avoid that I added this css.
.my-button .label {
-fx-padding: 0;
}
which works.