Here's the code in the example that checks to see if the user canceled the task or if the task exited normally: Create a horizontal progress bar.The no-argument constructor initializes the progress bar with a minimum and initial value of 0 and a maximum of 100.
Jprogressbar not updating
The section Using Indeterminate Mode tells you how to animate a progress bar to show activity before the task's scope is known. Instead, an instance of this class monitors the progress of a task and pops up a dialog if necessary.
See How to Use Progress Monitors for details and an example of using a progress monitor.
Sometimes a task running within a program might take a while to complete.
A user-friendly program provides some indication to the user that the task is occurring, how long the task might take, and how much work has already been done.
The constructor with two integer arguments specifies the minimum and maximum values. The model establishes the progress bar's constraints and values, so you can use it directly as an alternative to using the individual set/get methods listed above.