CountDownLatch example

Click here to see the Applet in action.
Click here to see the Applet in action.

As shown above, the 4 progress bars start one after another after the start button is clicked.

The following code is for the JPanel with the 4 progress bars:

This is the Thread using the CountDownLatches to coordinate between each other:

Finally, this is the Applet code:

The sources can be found here: https://github.com/paawak/blog/tree/master/code/Demo

 

Leave a Reply

Your email address will not be published. Required fields are marked *