-1

javafx font issuejavafx application font issue

Problem Hi, i am studying javaFX, and trying to run aplication which showing data from database MySQL8 + Hibernate. Data and files are shown, but there some issue with font presentataion. Could you advice something, how to fix it?

import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;

public class AppTest extends Application {

    @Override
    public void start(Stage primaryStage) throws Exception {

        Parent root = FXMLLoader.load(getClass().getResource("/views/allAdsView.fxml"));
        primaryStage.setTitle("My First App");
        primaryStage.setScene(new Scene(root, 1280, 800));
        primaryStage.show();
    }
}

1 Answers1

0

it's because the character encoding and default font "System" font is used, add this to your css (or any other font you wish to use),

* {
-fx-font-family: 'Arial';
}

since you said MySQL8 + Hibernate, you should also check the character encoding in the database. check this post, Hibernate + MySQL: How to set the encoding utf-8 for database and tables

Arun Panneerselvam
  • 2,263
  • 1
  • 17
  • 24
  • thanks, but this solution did not help, one of my frirend run this code, and he had proper representation. I think it is problem in windows fonts – Oleks Oleks Apr 09 '20 at 17:13