Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java Build a JavaFX Application Design a Better App Grids

Why am I not getting the Papyrus Font?

Here is my code..

package sample;

import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Group;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.VBox;
import javafx.scene.text.Font;
import javafx.scene.text.Text;
import javafx.stage.Stage;




public class Main extends Application {

    @Override
    public void start(Stage primaryStage) throws Exception{
//        Parent root = FXMLLoader.load(getClass().getResource("sample.fxml"));
        Group root = new Group();
        Text txt = new Text("Sup?");
        txt.setFont(new Font("Papyrus", 80));
        Label label = new Label("Name:");
        TextField nameField = new TextField();
        GridPane grid = new GridPane();
        grid.add(label, 0, 0);
        grid.add(nameField, 1, 0);
        grid.setHgap(20);
        Button btn = new Button();
        grid.add(btn, 1, 1);
//        grid.setGridLinesVisible(true);
        btn.setText("Say Sup!");
        btn.setOnAction(evt -> System.out.printf("Sup %s!%n", nameField.getText()));
        txt.setY(50);
        VBox box = new VBox();
        box.getChildren().addAll(txt, grid);
        root.getChildren().add(box);
        primaryStage.setTitle("Sup");
        primaryStage.setScene(new Scene(root, 300, 275));
        primaryStage.show();
    }


    public static void main(String[] args) {
        launch(args);
    }
}
Anuraag Mishra
Anuraag Mishra
Courses Plus Student 4,286 Points

Faced Same Problem, This course was going Flawlessly till now, BrainStormed, then remembered i faced the similar problem while doing some CSS work while back.

SOLUTION: just put Family name in single inverted comma like 'Arial' or 'Papyrus' or 'Comin Sans MS'. style="-fx-font-family: 'Comic Sans MS'"

Papyrus may not work in windows as it does not come pre-installed on windows.

4 Answers

Seth Kroger
Seth Kroger
56,413 Points

You won't get it if the Papyrus font isn't already installed on your computer. There is a way to load a custom font in the next program of the course, but the way it's done here can only access fonts that are available on your system.

Thanks.

Test Test
Test Test
21,581 Points

On Windows you don't have this Font pre-installed. You can pick another one like "Algerian" font looks pretty cool.

I have a pretty fresh Windows 10 installtion, and I have that font.

I haven't installed a lot, but ok... I have a full version of MSOffice installed...

Craig Dennis
STAFF
Craig Dennis
Treehouse Teacher

Hi Michael!

Are you on Windows? Trying to track down the root problem so I can update the notes.

Thanks, Craig

Hi Craig,

I'm on a fairly new and bare Windows 10 installation, and the Papyrus font does not appear either. The font does correctly scale up to size 80 though.

Nino Ross
Nino Ross
8,264 Points

I am on windows and I still can't change the font. Papyrus, Algerian, Ariel, comicsans nothing works :(

Anuraag Mishra
Anuraag Mishra
Courses Plus Student 4,286 Points

Faced Same Problem, This course was going Flawlessly till now, BrainStormed, then remembered i faced the similar problem while doing some CSS work while back.

SOLUTION: just put Family name in single inverted comma like 'Arial' or 'Papyrus' or 'Comin Sans MS'. style="-fx-font-family: 'Comic Sans MS'"

Papyrus may not work in windows as it does not come pre-installed on windows. Posting Solution on other Discussions with same problem too.

Menno Gouw
Menno Gouw
2,375 Points

I skimmed over the comments to find a link to the font, since I am a perfectionist and want to follow the video as closely as possible, but unfortunately could not find it. A quick google search led me to this page and you can download the font for free here. What bothers me is the lack of license or creator info. Someone made this and thus it has copyright protection but this site just puts it up for download. I am sure you will be alright using it just for the tutorial but I would not recommend to use it for any other projects until you know what license it has. This includes open source projects and all other types of projects.

Anyway, the font is not exactly the same but it is pretty close. Just open the archive and install the .ttf file, it is named "Papyrus" and your program should immediately pick it up once you installed it.