'When running the program in netBeans the font looks extremely weird
I set up netBeans and a SceneBuilder on my new MacBook M1 and everything works, except of the font when running the program.
It looks like this:
and I have no clue why. The Button should say: "Click me" and the Label: "Hello".
The Error message I get is:
März 31, 2021 6:33:04 PM javafx.fxml.FXMLLoader$ValueElement processValue
WARNING: Loading FXML document with JavaFX API of version 16 by JavaFX runtime of version 11.0.2
2021-03-31 18:33:05.466 java[4349:140717] 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:].
2021-03-31 18:33:05.466 java[4349:140717] CoreText note: Set a breakpoint on CTFontLogSystemFontNameRequest to debug.
2021-03-31 18:33:05.471 java[4349:140717] 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:].
2021-03-31 18:33:05.641 java[4349:140751] 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:].
Solution 1:[1]
I also had the same issue, but in my case, the problem was with JDK 11. First, I tried to switch to JDK 8 and everything worked fine, but then I found that another version of JDK 11 (AdoptOpenJDK(HotSpot) 11) also fixes it.
Solution 2:[2]
In my case that crap came up when I run programm on mac (on pc was all good).
For me shortest way to solve this was one record in stylesheet:
.root{
-fx-font-size: 11pt;
-fx-font-family: "Arial";
}
Solution 3:[3]
In my case, I was using the JavaFX 11 with the JDK11 and that was giving the weird characters, so I changed it to JavaFX 16 and also started using the JDK16 and that fixed my problem!
Solution 4:[4]
Solution 5:[5]
I was able to resolve the issue by adjusting the JDK version. Although I did not have JDK 8, JDK 14 worked fine and JDK 17 did not. It will work fine if you change the project structure to a more compatible JDK version with JavaFX.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Kirby |
| Solution 2 | Gun?rs Šmerli?š |
| Solution 3 | Any 07 |
| Solution 4 | Tomerikoo |
| Solution 5 | Sakhawat |


