Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem with the progress bar.... please help me..

Status
Not open for further replies.

cc14

Programmer
Aug 11, 2003
1
RO
I have a progress bar and a button on a form. When i push the button I execute several things but I want in the same time to increse the value of the progress bar. Why the changement is visible only at the end? Can somebody help me? Thanks a lot.

void button2_actionPerformed(ActionEvent e) {

jLabel1.setText("Sending...");

jProgressBar1.setStringPainted(true);
jProgressBar1.setMinimum(0);
jProgressBar1.setMaximum(fileManager.ContainFolder("Outbox").length);

jProgressBar1.setValue(0);
jProgressBar1.revalidate();
jProgressBar1.setStringPainted(true);

smtp.OpenConnection(extractor.GetSmtp(),extractor.GetUser(),extractor.GetPassword(), 25,jTextArea1 );

for (int i=0;i<fileManager.ContainFolder(&quot;Outbox&quot;).length;i++)
{
if (smtp.SendMessages(extractor.GetEmail(),
extractor.GetToEmail(&quot;Outbox/&quot;+fileManager.ContainFolder(&quot;Outbox&quot;)),
extractor.GetSubject(&quot;Outbox/&quot;+fileManager.ContainFolder(&quot;Outbox&quot;)),
extractor.GetName(),
extractor.GetToName(&quot;Outbox/&quot;+fileManager.ContainFolder(&quot;Outbox&quot;)),
extractor.GetBody(&quot;Outbox/&quot;+fileManager.ContainFolder(&quot;Outbox&quot;)),jTextArea1)==1)
//move from outbox to sent
fileManager.RenameMoveFile(&quot;Outbox/&quot;+fileManager.ContainFolder(&quot;Outbox&quot;),&quot;Sent/&quot;+fileManager.ContainFolder(&quot;Outbox&quot;));
jProgressBar1.setStringPainted(true);

jProgressBar1.setValue(i+1);

// ???????
// WHY DOESNýT MODIFY THE VALUE EXCEPT TO THE END WHEN BECOMES 100%

jProgressBar1.revalidate();
jProgressBar1.repaint();
jProgressBar1.setStringPainted(true);
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top