I saved the default font type and size for my application in a CSS file that I use with the code:
label.getStyleClass().add("labelStyleClass");
However, I also added a function that, if the user provides their own preferences, should override the default settings (specified above) and use the font size provided by the user:
double userSize = readFromFile; label.setFont(new Font(userSize));
In this case, calling label.setFont() does not set the new size specified by the user. When I comment on CSS source code, later work.
Any workaround?
Note: cross reference to JavaFX forum
source share