i\'ve created fxml files in anchor pane but everytime i click on the button i get the next fxml in a new frame i want it to open in the same frame
public void ba
Just create a single Stage
and when you want to replace the content of the stage with a new fxml, load the new fxml into a new Scene
and call stage.setScene
.
It's a theater metaphor - imagine you are watching a play - it's Romeo and Juliet, the curtain raises and you see the first scene (a plaza in Verona with a fountain). Later on, the curtain lowers, little men run around and change stuff, the curtain rises and you see a new scene (the balcony to Juliet's bedroom). The scene has changed, but the stage has not - there is just one stage and multiple scenes.