I am trying to port a .NET app over into java and need an asynchronous downloader that increments a progress bar once a download (or asynchronous task) completes, similar to .NET’s WebClient and its DownloadFileCompleted event. The app will be waiting for the downloads to complete, but I don’t want the UI to lock up over the course of the downloads with “Not Responding”. The problem lies in the inability of the download thread to directly increment the progress bar, since it was created in the main thread. I was thinking, since this is a SWT app (which has an os message pump loop), that I could somehow pump a message from the download thread and let the main thread pick it up. Is this possible? Is there another way?
Share
try to use Display.asyncExec to update progress bar value from download thread.
I’m not sure to have understood, but maybe something like this can run: