Intellj Idea JavaFx wrong Encoding


I made a JavaFx application using SceneBuilder and now when i run the app the text is the wrong font, in the code the labels are correct.

<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>

<AnchorPane id="AnchorPane" prefHeight="387.0" prefWidth="489.0" xmlns:fx="" xmlns="" fx:controller="sample.Controller">
<Label fx:id="label" layoutX="126" layoutY="120" minHeight="16" minWidth="69" />
<Label layoutX="281.0" layoutY="55.0" text="Port" />
<TextField layoutX="100.0" layoutY="49.0" />
<Label layoutX="25.0" layoutY="87.0" text="Datenbank" />
<TextField layoutX="100.0" layoutY="83.0" />
<Label layoutX="24.0" layoutY="120.0" prefHeight="17.0" prefWidth="69.0" text="Username" />
<TextField layoutX="100.0" layoutY="116.0" />
<Label layoutX="24.0" layoutY="149.0" prefHeight="17.0" prefWidth="69.0" text="Passwort" />
<Label layoutX="26.0" layoutY="53.0" text="Hostname" />
<TextField layoutX="311.0" layoutY="51.0" prefHeight="25.0" prefWidth="69.0" />
<Button layoutX="328.0" layoutY="154.0" mnemonicParsing="false" text="Get Data" />
<Separator layoutY="188.0" prefHeight="9.0" prefWidth="489.0" />
<TableView layoutX="17.0" layoutY="197.0" prefHeight="168.0" prefWidth="456.0">
<TableColumn prefWidth="75.0" text="Gemeinde" />
<TableColumn prefWidth="133.0" text="Verwaltungseinheit" />
<TableColumn prefWidth="75.0" text="Hauptstadt" />
<TableColumn prefWidth="75.0" text="Einwohner" />
<TableColumn prefWidth="97.0" text="Webseite" />
<PasswordField layoutX="100.0" layoutY="145.0" />
<MenuBar layoutY="-1.0" prefHeight="31.0" prefWidth="500.0">
<Menu mnemonicParsing="false" text="File">
<MenuItem mnemonicParsing="false" text="Close" />

Comment actions Permalink


Please try using the escaped Unicode sequences to see if it helps. See the related discussion at .

See also .

Comment actions Permalink

I tried it, did not work.

Comment actions Permalink

The problem is not reproduced for my work environment. What file encoding do you see in the bottom right corner of the editor? Does it help if you add -Dfile.encoding=UTF-8 in Help | Edit Custom VM Options and restart IntelliJ IDEA?

Comment actions Permalink

you can fix by adding -fx-font-family to your .root, e.g.

.root {
-fx-font-family: "Arial";

not sure what is different about my new env that i can't load the font, but that in the console about font loading and a search in stackoverflow with that error message got me this fix

java[3129:69795] CoreText note: Client requested name ".SFNS-Regular", it will get Times-Roman rather than the intended font. All system UI font access should be through proper APIs such as CTFontCreateUIFontForLanguage() or +[NSFont systemFontOfSize:].


Please sign in to leave a comment.