Let the user continue working while waiting for a long running database operation to return the dataset
How do I display the "running circle" while that operation is executing?
I want the user to be able to tab to other JavaFX tabpanes and work on something else.
The keyword here is "decoupling" and failing to do it correctly is a common beginner issue wich lead to your mentioned "locking up of the whole application".
It comes down to how GUIs in Java work (keyword "EDT" - Event Dispatch Thread) and that beginners often not correctly understand why they need to run their code in a different thread than where the event is triggert.
Just by experience I guess your code looks a bit like this: You have some listener wich reacts to some event triggert by some button or alike and then, as the query takes time, your application becomes unresponsive. That's because you most likely locking up the EDT wich needs to always run clean by itself to keep the UI responsive. Care must also be taken when you want to update your GUI after your task has finished: You have to re-inject anything modifying the GUI back into the EDT. In Swing this is done with SwingUtilities.invokeLater(). FX should have something similar.
posted 2 months ago
If I remember correctly, a call to Application#launch() starts the corresponding thread in FX. You are liable to find FX applications crash with exceptions if you try to run anything on the wrong thread.