when I am trying to call method updateProgressBar method when the Jbutton is clicked but the progress is not displayed only the blank dialogue Box appear till the value reached 100%.
following is the method from class ProgressBar which will display Jdialogue box with progress bar.
public void updateProgressBar(int i)
{
pb.setString("Processing " + i + "%");
pb.setValue(i);
try
{
Thread.sleep(100);
}catch(Exception e)
{
e.printStackTrace();
}
}
following is how it is called from Jframe.
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
ProgressBar pd=new ProgressBar();
int i=1,j=100;
pd.setVisible(true);
while (i<=50)
{
pd.updateProgressBar(i);
i++;
}
pd.dispose();
}