简体   繁体   中英

JavaFX application on Mac OS

I've written app on JavaFX and it's starting successfully on Linux and Windows, but not on mac os. It's showing in processes and there is no exceptions or errors, but GUI not showing. What special is needed to start such app on mac?

I also tried simple hello world application:

public class TestApp extends Application {
  @Override
    public void start(Stage primaryStage) {
        primaryStage.setTitle("Hello World!");
        Button btn = new Button();
        btn.setText("Say 'Hello World'");
        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.setFullScreen(true);
        primaryStage.setScene(new Scene(root, 300, 250));
        primaryStage.show();
    }


   public static void main(String[] args) {
        launch(args);
    }

}

without no luck ( the same behavior: no GUI is showing, but is showing in processes)

I'm using java 1.7, OS X version: 10.8.5

解决方案是更新到Java 8

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM