Reputation: 1930
I am trying to call a function initialStep() of MainApp class from ProcessStatements class. When the function initialStep() is called, i want to show progress bar to the user till the initialStep() function completes the execution.
How can i do this using Java Swing? Please someone help me out. Thanks in advance :)
Upvotes: 1
Views: 643
Reputation: 1119
J2SE Documentation report the same issue as example of using SwingWorker class:
SwingWorker
Upvotes: 2
Reputation:
I recommend using a SwingWorker for the task.
The main issue is that the Swing stuff needs to be done on the EDT (Event Dispatch Thread). The SwingWorker takes care of all that. The progress bar can be a simple JProgressBar in a window or whatever is desired.
Happy coding.
Upvotes: 6