-1

I am working on a JavaFX project and the problem that I am facing is that I can't connect the different pages for my application. I can't go from another FXML file to another FXML File. For example I have two FXML Files. One for the Login Screen and one for the Menu. What I want is that when I click on the login button of my Login screen that I immediately go to my Menu Screen.

Tony Stark
  • 45
  • 1
  • 8
  • 1
    You would do that in the controller. – James_D Oct 25 '16 at 13:00
  • Problem is it doesn't work in the controller. That is why I am asking haha. I am exporting different files from my team, but they somehow can't connect with each other. – Tony Stark Oct 25 '16 at 13:22
  • Possible duplicate of [Login Application with 1 stage and multiple scene in JavaFX](http://stackoverflow.com/questions/23627340/login-application-with-1-stage-and-multiple-scene-in-javafx) – fabian Oct 25 '16 at 13:46
  • 1
    "It doesn't work" is not a problem description, and no-one can really tell you what you're doing wrong from what you have posted in your question. The correct way to do this is from the controller code. I recommend you create a [MCVE] (emphasis on *minimal* and *complete*) that shows what you have tried and what is not working and [edit] your question to include it. – James_D Oct 25 '16 at 14:03

1 Answers1

1

One way to transition from one screen to another is to assign a new Scene to a Stage using the setScene method of Stage.

Another way is to assign a root node like BorderPane to the Scene and swap FXML using its set methods(setTop, setCenter etc.) as per your application needs (In your case, on logging in).

TBF
  • 82
  • 1
  • 1
  • 8