Reputation: 6039
I have to scale/change by button's text size dynamically whose default values are in CSS
.button {
-fx-font-size: 20;
}
in JavaFx
button.getStyleClass().add("button");
Now I have to scale the fonts by factor 2 but there is no way to find the existing font size so that I could just multiply the factor
button.setStyle("-fx-font-size:"+oldVal*2);
How do I get the existing font size ?
Upvotes: 0
Views: 914
Reputation: 18415
It's as easy as using
button.getFont().getSize();
It works only after the stage was shown.
Upvotes: 1