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?
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.