Reputation: 197
I'm trying to make a loading screen for a game that shows whenever a level is being generated. When the game isn't doing anything, the loading screen works just fine. But when I put in the code to generate levels, the loading screen is a blank screen and the application becomes unresponsive until the loading is done. The question is, how can I make it so the level generator doesn't interfere with the loading screen and the rest of the application? I'm using the swing timer to control the loading animation. And I don't want to use threads because the level generator will be used multiple times, and I know that a thread's run method can only be called once.
Upvotes: 1
Views: 456
Reputation: 197
I learned from jewelsea that I can use the javafx.concurrent.Task class to help with background processing that is resource heavy.
Upvotes: 1