package bugs; import javafx.application.Application; import javafx.beans.value.ChangeListener; import javafx.beans.value.ObservableValue; import javafx.scene.Scene; import javafx.scene.control.*; import javafx.scene.layout.VBox; import javafx.scene.text.Font; import javafx.stage.Stage; public class RT20145 extends Application { public static void main(String[] args) throws Exception { launch(args); } public Button createButton() { Button b = new Button("BUTTON"); b.setFont(new Font(24)); System.out.println("FONT " + b.getFont()); b.fontProperty().addListener(new ChangeListener() { @Override public void changed(ObservableValue arg0, Font arg1, Font arg2) { System.out.println("OLD " + arg1 + " NEW " + arg2); } }); b.setId(b.getText()); return b; } public void start(final Stage stage) throws Exception { Font.loadFont(RT20145.class.getResourceAsStream("arialw7.ttf"), 12); String cssFontUrl = RT20145.class.getResource("RT20145.css").toExternalForm(); VBox root = new VBox(); root.getChildren().add(createButton()); Scene scene = new Scene(root, 600, 600); scene.getStylesheets().add(cssFontUrl); stage.setScene(scene); stage.show(); } }