'Load game state while JFrame remains responsive

the loading function of my program is running in the main thread. I can't draw any changes on the JFrame during the process. If I use a SwingWorker, the loading process gets chronologically messed up and the construction of the Swing elements is buggy.

A hanging GUI during loading would be undramatic. The only thing is that I would like to include a loading animation. I have already created this, it runs in a new thread.

What are the possibilities to pause the loading process from the thread to draw the changes on the JFrame?

I will gladly embed code. However, the loading process runs through the entire program. So just ask for useful snippets.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source