public class Main extends Application {
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage primaryStage) {
primaryStage.setTitle("Hello World!");
Button btn = new Button();
btn.setText("Hello");
btn.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
System.out.println("Hello World!");
}
});
StackPane root = new StackPane();
root.getChildren().add(btn);
primaryStage.setScene(new Scene(root, 300, 250));
primaryStage.show();
}
}
Run Code Online (Sandbox Code Playgroud)
在控制台上获取以下第一行:
35026:1978749] CoreText 注意:客户端请求名称“.SFNS-Regular”,它将获得 Times-Roman 而不是预期的字体。所有系统 UI 字体访问都应通过适当的 API,例如 CTFontCreateUIFontForLanguage() 或 +[NSFont systemFontOfSize:]。2021-06-09 00:00:46.808 java[35026:1978749] CoreText 注意:在 CTFontLogSystemFontNameRequest 上设置断点进行调试。2021-06-09 00:00:46.815 java[35026:1978749] CoreText 注意:客户端请求名称“.SFNS-Regular”,它将获得 Times-Roman 而不是预期字体。所有系统 UI …