我的應用程序中有一個簡單的JForm和一個JDialog。的JDialog框包含的JProgressBar eliment和I'put在一個JDialog的方法,如何更新j進度條
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);
}
}
我已經設置了jprogressbar的最大值,但仍然遇到同樣的問題。 – Harsha 2012-02-15 06:49:00
爲了澄清問題,JProgressBar是否顯示在JDialog上,即顯示零進度的條形圖? – 2012-02-15 06:58:05
是的進度條顯示在JDialog上 – Harsha 2012-02-15 07:01:09