I am developing a game of Quiz, with a web server and a client. Now, when the client connects to the server, it crashes. The reason is that code which takes a long time to run, should be executed on a background thread and not on the FX Application Thread. This means that I have to:
reate a task, that handles the data from the web server.
egister a handler that sends the results to the UI when it's complete.
nvoke the task on a background thread.
But I how do I do this when it's a runnable method that is handling the input from the server? I am trying to implement the tutorial that you can find at Using threads to make database request
Using threads to make database requests
The problems occur when I am coming to this part of the code:
The Client Class: