Implemetation Hints:
you should use a constructor for your Controller that injects the Model
JavaFx Implemetation Hints:
public class App extends Application {
public static void main(String[] args) {
launch(args);
}
private Pane root;
@Override
public void init() {
Game game = new Game();
ControllerFactory controllerFactory = new ControllerFactory(game);
try {
FXMLLoader fxmlLoader = new FXMLLoader(getFxml());
fxmlLoader.setControllerFactory(controllerFactory);
root = fxmlLoader.load();
} catch (IOException e) {
LOGGER.debug//Log output please ("error",I euse a Logger for that);
}
RootController rootController = controllerFactory.getRootController();
game.init();
rootController.init();
}
@Override
public void start(Stage stage) {
if (root != null) {
stage.setScene(new Scene(root));
stage.setTitle("title");
stage.show();
} else {
LOGGER.debug//Log output please ("errorI duringuse init"a Logger for that);
Platform.exit();
System.exit(0);
}
}
}
