3

cheers,

i am fairly new to JavaFX2. I already did some research about the basic principles: Stages that contain Scenes. Scenes in turn can be switched. But only switching parts of scene does not seem to be common usage.

My Problem: I am trying to create an application with a titlepane (containing a lable and some buttons) and a Pane containing further dynamic content. The titlepane will stay there throughout the whole lifecycle.

Now i am confused about what is the best way to achieve such a layout. I found some ideas like here to make my root layout a Borderpane and switch its center. In that case i would end up with only one scene. But i am not shure if that´s how it should be done.

Any help and ideas on this topic is very appreciated. cheers tobi

P.S.: i am using FXML files to create my layout and Controller to handle each view.

Community
  • 1
  • 1
Tobias
  • 45
  • 1
  • 5
  • is there no one who could suggest me some best practice approaches? Help would be highly appreciated :) – Tobias Jun 05 '16 at 08:57

1 Answers1

2

Well there is this question: Loading new fxml in the same scene, which is (perhaps) a duplicate of yours. I wouldn't call the solution there a "best practice", but it is likely decent enough for a smallish app. The answer provides a small framework for swapping fxml controlled content panes in and out of a portion of the main scene.

Similar is Angela's Managing Multiple Scenes.

More comprehensive solutions are things like Gluon Desktop (which I haven't used) or afterburner.fx.

For an actual non-trivial application, look at the SceneBuilder application, which is probably the best "best practice" reference you could find for a decent sized JavaFX application. But, as it is non-trivial, understanding its architecture is likely non-trivial too.

Community
  • 1
  • 1
jewelsea
  • 150,031
  • 14
  • 366
  • 406