I have put together a relatively small app which calculates some properties of a graph to help me learn JavaFX. The GUI opens a new tab for each graph created. Since some of the calculations can be quite long running (e.g. with a large number of nodes specified), I want to show the new tab and have the properties display "Calculating..." until they have been computed, at which point they should then show the result. However, what actually happens is that the app hangs until all the calculations have been completed.
Each of the calculations is computed using a Task:
When creating the view, the individual tasks are specified, e.g.:
With the result of the Task as a Worker bound to the textProperty() of the relevant TextField:
Once the View has been added to a new Tab and shown, I execute the tasks:
For what it's worth, full source code is available on GitHub
What am I doing incorrectly that causes the app to hang until the tab has finished calculating all the values?