I have a simple JForm and a JDialog in my application. JDialog box contains a JProgressBar eliment and I'put a method in the JDialog as,

```
 public void updateProgress(int val){
        prgProgress.setValue(val); //prgProgress-> name of the JProgressBar
    }

```

to update the progress bar.

When I try to update the progress bar in my JDialog from the JForm, JProgressBar doesn't update as expected please tell me what could be the error,

Ex.

```
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);
    }

}

```