How can I set the Font type globally in a JavaFX application?
Is there any solution that I can use? In JavaFX 8 the default Font has changed, and I would like to use the same Font used in JavaFX 2.2.
There is a Segoe UI as default Font on your Windows 7 system, but the version is 5.01 per default.
You can change the font size and color of the text using the setFont() method. This method accepts an object of the Font class. The class named Font of the package javafx.
You can skin your application with CSS as described on the Oracle Website. Using following syntax you may set the general theme for your application:
.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 css as followed:
scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With