0

My JavaFX and FXML application loads is as follows:

  1. A login screen. Once the credentials are input the login stage closes and the MainGui.FXML launches with its own controller: MainGuiController.java

  2. MainGuiController also calls controllers for other GUIs because so far in my scene, all I have is a menu and a blank main body. When a menu item is selected a Connection object is passed to the new stage's controller and the stage opens up in a new window. So far so good.

However, I was thinking of changing the design and having the content that's displayed from menu interaction displayed in the empty body portion beneath my menu. I don't like the idea of having many stages open with the potential for NPEs because I do have a database that I work with.

How do I add new content [from existing FXML files] to a blank anchor pane underneath my menu every time a menu item is selected?

jewelsea
  • 150,031
  • 14
  • 366
  • 406
Nepze Tyson
  • 587
  • 2
  • 7
  • 16
  • 1
    Related question: [How to have menus in java desktop application](http://stackoverflow.com/questions/13556637/how-to-have-menus-in-java-desktop-application) – jewelsea Jun 12 '13 at 20:21
  • Thanks! I took a slightly different approach. I realized I could pass the main scene and stage as parameters to the main controller's constructor and from there just load an fxml file directly into my anchor pane... Wow, I just realized I didn't even frame the title of the question correctly. – Nepze Tyson Jun 12 '13 at 22:29

1 Answers1

0

And just for information, you can easily include one fxml file into another fxml file. for ref: fxml include

Shreyas Dave
  • 3,815
  • 3
  • 28
  • 57
agonist_
  • 4,890
  • 6
  • 32
  • 55