try {
for (int i = 0; i < 100; i++) {
jProgressBar1.setValue(i);
Thread.sleep(500);
}
} catch (Exception ee) {}为什么只有循环执行完了以后才设置进度条??
for (int i = 0; i < 100; i++) {
jProgressBar1.setValue(i);
Thread.sleep(500);
}
} catch (Exception ee) {}为什么只有循环执行完了以后才设置进度条??
for (int i = 0; i < 100; i++) {
jProgressBar1.setValue(i);
Thread.yield();
Thread.sleep(500);
}
} catch (Exception ee) {}
这样不行..
public void run()
{
try {
for (int i = 0; i < 100; i++) {
jProgressBar1.setValue(i);
Thread.yield();
Thread.sleep(500);
}
} catch (Exception ee) {}
}
}.start();
我回答了无数这样的问题了。这都是SWING包的线程问题。
public void run()
{
try {
for (int i = 0; i < 100; i++) {
jProgressBar1.setValue(i);
Thread.sleep(500);
}
} catch (Exception ee) {}
}
}.start();
我回答了无数这样的问题了。这都是SWING包的线程问题。
与上楼不同的是不要Thread.yield(),我看错了,复制上去的。
public void run()
{
try {
for (int i = 0; i < 100; i++) {
jProgressBar1.setValue(i);
Thread.sleep(500);
}
} catch (Exception ee) {}
}
}.start();------------你确保这种处理方法是线程安全的