Progress Bar is a component used to show the status of the application that how much time is left in order to complete the task of a specified application. In Java Progress Bar is created using swing. The Swing Class used for the implementation of Progress Bar is JProgressBar Class
In this Tutorial we want to describe you a program code that helps you in the implementation of Progress Bar in Java. This Program provides you how a Progress Bar show the status of your running application in progress.
The Program shows you a Class name' Progress Bar' with a button labelled with a name ' go'.
1)set String Painted- This is a Method that will provides you the complete progress in percentage of the Progress Bar. This method takes Boolean as parameter. The value set to be true to see the status on progress bar, otherwise the status of progress bar would not be visible.
2)setValue( )- This Method provides you to set the value of the Progress Bar.
3)iterate( )- This Method provides you if variable name num is less than 1000 millisecond in while loop then it set the current thread to execute in Progress Bar, otherwise it would execute the try block that remain thread to call sleep ( )method and remain inactive for 500 milliseconds, that is subsequently handled by catch block.
If you enjoyed this post then why not add us on Google+? Add us to your Circles
Liked it! Share this Tutorial