Since I can't use Scene builder to set this method
I'm trying to get the Window of the scene that is now displayed and set the method
public class MainController {
@FXML
private Button Settings;
public void initialize() {
Window w =Settings.getScene().getWindow();
w.setOnCloseRequest(ac->{
System.out.println("Done");
});
}
}
Then I have noticed that w = null ... and the get Scene method returns null too..
so 1) is there any way to make this with Scene builder without using (initialize way) 2) how can i fix the code above so i can use the window ?