ASSIGNMENT:
-
Create a Swing form in Eclipse looking like the above form
-
Create a thread class that will accept as parameters:
- Progress bar
- Thread total label
- Grand total label
- Interval in ms to be used as a parameter for sleep method between each step of a thread
-
Implement a thread class to:
- Count from 1 to 100 with a sleep time between steps defined by a parameter
- On each step update in a thread safe manner GUI display (progress bar, total label and grand total label)
-
IMPORTANT: Create a critical section within a thread to update ‘Grand Total’ label value. This critical section has to include sleep(50). The only access to Grand Total should be through the text property of ‘Grand Total’ label (don’t keep any additional variable to store it).
-
When pressing ‘Start’ button start 4 instances of a thread class with different intervals and be able to view their progress
-
Implement ‘Pause’ and ‘Resume’ buttons
-
Use proper way to update Swing GUI components from within a thread