0

Hi everyone,

I'm making a application in which I need to share a lot of properties between Controllers, so I am using a observable class now which I got from the internet. In the example I'm viewing the person in question is using a initialize method in the Main class of the program. It looks like this:

@FXML
public void initialize() {
    this.parametersController.initialize(this.simulator);
    this.controlsController.initialize(this.simulator);
    this.cashRegisterController.initialize(this.simulator);
    this.cashRegisterController.initialize(this.simulator);
}

I did exactly the same in my program, but my initialize method is not being called by Java. If I open his example project in IntelliJ it shows his method is indeed being used. Example:

enter image description here

In my own code however, IntelliJ is showing me that the method is not being used. Example:

enter image description here

If I place a breakpoint in the initialize method, I can indeed confirm it is never being called.

Why is this? What am I doing wrong? I can't figure it out.

Thanks in advance to everyone!

Community
  • 1
  • 1
KittyCat
  • 415
  • 4
  • 9
  • 26
  • Does this answer your question? [Applying MVC With JavaFx](https://stackoverflow.com/questions/32342864/applying-mvc-with-javafx) – SedJ601 Nov 13 '19 at 15:11
  • Do you catually use the controller? Have you implemented `Initializable`? This would take precedence over your `initialize` method... – fabian Nov 13 '19 at 17:26
  • @Sedrick Hi, thank you for replying. I know how MVC works, and everything is fine, but I just need to call all the initialize methods on my controllers manually in order to make things work in my application. – KittyCat Nov 14 '19 at 08:35
  • @fabian I have not implemented `Initializable` because I don't want the initialize method to fire automatically, I need to fire it manually because I need to pas a parameter to all controllers of type Simulator. – KittyCat Nov 14 '19 at 08:36

0 Answers0