I am trying to update the background color but after entering the code below I am getting a null pointer exception.
I checked the path and added / but still nothing.
I am trying to update the background color but after entering the code below I am getting a null pointer exception.
I checked the path and added / but still nothing.
try {
Parent root = FXMLLoader.load(getClass().getResource("Main.fxml"));
Scene scene = new Scene(root,600,400);
scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm());
//For more scenes:
//String css = this.getClass().getResource("application.css").toExternalForm();
//scene.getStylesheets().add(css);
//
primaryStage.setScene(scene);
primaryStage.show();
} catch(Exception e) {
e.printStackTrace();
}