Set Font globally in 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());
Get system default font
JavaFX makes this a lot easier:
import javafx.scene.text.Font;
then use:
Font defaultFont = Font.getDefault();
or
// Where 14 is the font size
Font defaultFont = new Font(14);
Is the JavaFX default font platform independent?
No, it's not. I toyed around with JavaFX to Android conversion. It turned out that the symbols were missing in the cards.
Related Topics
"Hello World" Function Without Using C Printf
Awk, Pipe and Tail -F Giving Unexpected Behavior
Cache Coloring on Slab Memory Management in Linux Kernel
Force Netcat to Send Messages Immediately (Without Buffering)
Conditional Awk Hashmap Match Lookup
Scp Command Between 2 Servers with 2 Different .Pem Keys
Exactly When Tasklet Runs After It Is Schedule by Isr
X86 Assembly, Little Endianness Not Being Followed(Or Is It) (Linux)
Ensure Config.H Is Included Once
Linux Stand Alone Executable Generation
Oracle Instant Client: Ora-28759: Failure to Open File
Unix Unzip: How to Batch Unzip Zip Files in a Folder and Save in Subfolders
Path Issue After Compiling Curl
How to Split Two Vertical Pane Inside a Horizontal Pane in Tmux Using Tmuxinator
/Usr/Local/Ssl/Lib/Libcrypto.A: Could Not Read Symbols: Bad Value
Dos2Unix: Binary Symbol Found, Skipping Binary File