I have a JavaFx application with following files:
- MainApp.java - Java class responsible for handling the application
- Controller.java - Corresponding controller file
- Design.fxml - FXML file for the application which is loaded via MainApp.java and controlled by Controller.java
Now, let's say I have another class file as Compute.java which has a method (say doSomething()). When this method terminates, I wish to open a built-in Alert box or a custom FXML file on top of the original FXML file (say, a box which states "Work Completed").
Please suggest a neat solution for this (which does not involve moving the logic of Compute.java to any other file or to the Controller.java. Also, I wish to keep the Compute.java clean of JavaFx code).
Suggestion:
Since the main primary stage (and scene) held in MainApp,
you may inject this class into Compute
After that you call
where