import javafx.application.Application; import javafx.application.Launcher; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.control.Label; import javafx.scene.text.Font; import javafx.stage.Stage; /** * * @author joeri */ public class FontNotSetOnFirstLabel extends Application { public static void main(String[] args) { Launcher.launch(FontNotSetOnFirstLabel.class, args); } @Override public void start() { Stage stage = new Stage(); stage.setTitle("Font not set on first Label"); Font font = Font.font("Arial", 36); Label label1 = new Label("This is the first label."); label1.setFont(font); label1.setLayoutX(10); label1.setLayoutY(10); Label label2 = new Label("This is the second label."); label2.setFont(font); label2.setLayoutX(10); label2.setLayoutY(80); Group root = new Group(); root.getChildren().addAll(label1, label2); Scene scene = new Scene(root, 500, 200); stage.setScene(scene); stage.setVisible(true); } }