Reputation: 5146
In my SWT Application i wish to use a progress bar (org.eclipse.swt.widgets.ProgressBar) i found examples but could not understand the proper flow and usage i need to perform background task for which, i was paused at the algorithm phase like i can analyze that there should be two threads one for background job, another for a progressbar both should execute simultaneously, i could not figure out the Implementation of this,i found plenty of examples but,i was puzzled where should i place my background task code (still searching). Can anyone provide sample example that suits me.
Upvotes: 1
Views: 6174
Reputation: 4843
Did you see update a progress bar (from another thread) from SWT ProgressBar snippets page? It explains a lot.
ProgressBar
have to be asynchronous to work correctly in every GUI framework. It's job is to show some value independently on main (GUI) thread. So you have to write your own thread, which will maintain the ProgressBar, resolving current value of it and show the changes of value (rendering progress by widget itself).
In Swing, you don't have to create you own thread for ProgressBar, because the class already implements upper proposed behavior (makes itself another thread and manage the work for you). But because SWT is platform dependent (and for other reasons), you have to manage this by yourself.
Upvotes: 3