1

I am working on eclipse javafx project and this is the Main.java


package application;
    
import javafx.application.Application;

import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.layout.BorderPane;
import javafx.fxml.FXMLLoader;


public class Main extends Application {
    
    @Override
    public void start(Stage primaryStage) {
        try {
            BorderPane root = (BorderPane)FXMLLoader.load(getClass().getResource("Sample.fxml"));
            Scene scene = new Scene(root);
            scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm());
            primaryStage.setScene(scene);
            primaryStage.setTitle("Restaurant");
            primaryStage.show();
        } catch(Exception e) {
            e.printStackTrace();
        }
        
    }
    
    public static void main(String[] args) {
        launch(args);
    }
}

and eclipse doesn't show any error, but after run the program

-> nothing appear on the screen

and I don't why?

  • https://openjfx.io/openjfx-docs/#install-javafx – SedJ601 Jun 07 '22 at 13:46
  • 2
    Check https://stackoverflow.com/questions/57553993/no-window-comes-up-when-running-javafx-application – James_D Jun 07 '22 at 14:01
  • 3
    This means you are including the `javafx.swt` module; you probably don't need that. Another (perhaps better) solution is to not include that module. – James_D Jun 07 '22 at 14:09

0 Answers0