wanisramdani / tramway

Process-based simulation in Java/JavaFX à la MVC (more like MVP actually)
1 stars 0 forks source link

You can have only one controller per fxml file #8

Closed wanisramdani closed 4 years ago

wanisramdani commented 4 years ago

The solution is to create a custom controller

Reference: https://docs.oracle.com/javafx/2/fxml_get_started/custom_control.htm

wanisramdani commented 4 years ago

Better approach https://stackoverflow.com/questions/33581629/inserting-a-data-to-a-gridpane-in-another-fxml-file

djalilhebal commented 4 years ago

WorldView doesn't have to be a "controller". It only needs to do its job (i.e. manipulate the user interface).

Remember Philo's SimView? You only passed a Document to it and then SimView extracted the elements it needed and used them.

The same can be done with WorldView: The whole Stage or just a Group of elements can be passed to WorldView upon instantiation..