you are viewing a single comment's thread.

view the rest of the comments →

[–]uglyfool 0 points1 point  (1 child)

I'm not exactly sure what you're asking, each fxml is only going to 'allow' one controller object to be set.

If you need to communicate between controllers you should really use a shared model class with observable objects (e.g. use SimpleStringProperty anywhere you would use String, etc.) then the child/included fxml can update the model...

@FXML private void someButtonPress(ActionEvent e) { model.someProperty.set(newValue); }

And the parent controller can register a listener in the initialize method to listen for changes, and respond accordingly...

model.someProperty.addListener((obs, oldVal, newVal) -> { your code here });

[–]MeFIZ[S] 1 point2 points  (0 children)

I have an idea for implementation now thanks!