Font families available in JavaFX 8

47,437

Solution 1

You can get the list of installed font families by calling javafx.scene.text.Font.getFamilies();.

Solution 2

Personally I would attach a CSS sheet to your program, in that case you can set the default font family using .root, something like this;

    .root{
    -fx-font-family: "Courier New";
}

Here are some examples of some websafe fonts you could use in CSS;

http://www.webdesigndev.com/16-gorgeous-web-safe-fonts-to-use-with-css/

And:

http://www.w3schools.com/cssref/css_websafe_fonts.asp

Share:
47,437
Guido
Author by

Guido

Updated on July 09, 2022

Comments

  • Guido
    Guido almost 2 years

    In my JavaFX application, the user will have the possibility to choose the font or font family for displaying the menus, labels, combo boxes, check boxes etc. Where can I find the different font families available for JavaFX 8?