我的应用程序中有一个简单的 JForm 和一个 JDialog。JDialog 框包含一个 JProgressBar 元素,我在 JDialog 中放置了一个方法,
public void updateProgress(int val){
prgProgress.setValue(val); //prgProgress-> name of the JProgressBar
}
更新进度条。
当我尝试从 JForm 更新我的 JDialog 中的进度条时,JProgressBar 没有按预期更新,请告诉我可能是什么错误,
前任。
public class Status extends javax.swing.JDialog{
private javax.swing.JProgressBar prgProgress = new javax.swing.JProgressBar;
.....
public void updateProgress(int val){
prgProgress.setValue(val); //prgProgress-> name of the JProgressBar
}
.....
}
public class MyForm extends javax.swing.JInternalFrame {
Status s = new Status();
s.setVisible(true);
for(int i=0; i<100; i++){
s.updateProgress(i);
}
}