Reputation: 53
I'm trying to change Scenes in my Java FX program with resetting the Scene like
stage.setScene(new Scene(new StartupPane(stage),Toolkit.getDefaultToolkit().getScreenSize().getWidth(),Toolkit.getDefaultToolkit().getScreenSize().getHeight()));
Is this a proper way to do it?
I also have the problem that the CSS style doesn't apply on the new Scene after the change of a Scene. Is there a proper solution for it or do you recommend me to use FXML (actually I have no experience with FXML)?
Upvotes: 0
Views: 1006
Reputation: 53
thanks a lot, it's working fine now for me. I only found answers with changing the XML controller or something like that, therefore I asked for XML. Thanks
Upvotes: 0
Reputation: 10640
Why do you want to change the scene? In general you can just change the root node of the scene and there is no need to change the scene itself.
Changing the scene can be done but this is independent of the question whether to use FXML or not.
Upvotes: 1