1

i build an Application and i have a button do a lot of things when i press it the application is freeze it for some second. So i just want put a jProgressBar here is my code :

String s="";
long l=System.currentTimeMillis();

for(int k=0;k<jTable3.getRowCount();k++)
{
    s=jTable3.getValueAt(k, 0).toString();
    myFunction(s);
}

long l2=System.currentTimeMillis();
JOptionPane.showMessageDialog(rootPane, "We are done in just "+(l2-l)+" MS");

Any help or suggest?

Kevin Kopf
  • 13,327
  • 14
  • 49
  • 66
hoger qassim
  • 37
  • 1
  • 9

1 Answers1

0

What you need to do is perform your lengthy/taxing operations on another thread, and then, from that thread, adjust the value of your JProgressBar. The progress will then be visible.

Some information on concurrency and threads.

cstr_
  • 98
  • 6