Javafx-2 – set fonts globally in JavaFX
•
Java
How do I set font types globally in JavaFX applications?
Is there a solution you can use? In JavaFX 8, the default font has been changed. I want to use the same font used in JavaFX 2.2
Solution
You can use CSS to draw applications as described on the Oracle website
.root{ -fx-font-size: 16pt; -fx-font-family: "Courier New"; -fx-base: rgb(132,145,47); -fx-background: rgb(225,228,203); }
You include the following CSS:
scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm());
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码