0

Hey i want change the font of my TextArea but this don't work I have found this But don't work :(.

And my Font.loadFont("file:resources/fonts/EditorFont.ttf", 120) return always null I have tried with css but don't work

                area = new TextArea();
        Color color = Constants.BACKGROUND;
        double red = color.getRed()*255;
        double blue = color.getBlue()*255;
        double green = color.getGreen()*255;
        String rgbColor = "rgb(" + red + ", " + blue + " , " + green + ")";

        setCanTakeAllSize(area);
        area.setOnKeyTyped(event -> highlight());
        area.setOnScrollFinished(event -> highlight());
        area.setStyle("" +
                "-fx-control-inner-background: " + rgbColor + ";" +
                "-fx-font-size: 2em;" +
                "-fx-font-family: Consolas;");
        area.setFont(Font.loadFont("file:resources/fonts/EditorFont.ttf", 120));
        //Logger.log(Font.loadFont("file:resources/fonts/EditorFont.ttf", 120));
        layout.add(area, 0, 0);

My resources directory

  • 2
    That is not how to load resources [this is](https://stackoverflow.com/questions/61531317/how-do-i-determine-the-correct-path-for-fxml-files-css-files-images-and-other). Do not follow tutorials with such errors. – jewelsea Nov 16 '22 at 07:42

0 Answers0