title: JProgressbar not showing (without threads)
body: <p>i have a program that takes some time creating pdf files
  i would like to show progress to user</p>
  
  <p>when i finish making a pdf file i try to call the progressbar to update its status:</p>
  
  <pre><code>ProgressDialog progress = new ProgressDialog(instance, numberOfInvoices);
  progress.setVisible(true);
  progress.setAlwaysOnTop(true);
  
  for(int i = 0 ; i&lt;numOfPdfs ; i++){
      progress.change(i + 1);
  }
  </code></pre>
  
  <p>the progressdialog looks like this:</p>
  
  <pre><code>public class ProgressDialog extends JDialog {
  
      private JProgressBar progressBar;
  
      public ProgressDialog(Window parent, int aantal) {
          super(parent);
  
          this.setPreferredSize(new Dimension(300, 150));
  
          progressBar = new JProgressBar(0, aantal);
          progressBar.setValue(0);
          progressBar.setSize(new Dimension(280, 130));
          this.add(progressBar, BorderLayout.CENTER);
  
          this.pack();
          this.setLocationRelativeTo(parent);
      }
  
      public void change(int aantal) {
          if (aantal &lt; progressBar.getMaximum() &amp;&amp; aantal &gt;= 0) {
              progressBar.setValue(aantal);
          }
      }
  }
  </code></pre>
  
  <p>all i get is an empty window (white)</p>
  
  <p>i looked around on this forum but the treads solution seems soo complex</p>
  
  <p>between calculation of 2 pdf files i should be able to update the gui, right?</p>
  
  <p>ok colin</p>
  
  <p>i tried this: (complete class)</p>
  
  <pre><code>public class ProgressDialog extends JDialog {
  
      private JProgressBar progressBar;
      private String message;
      private static int number;
  
      public ProgressDialog(Window parent, int max, String message) {
      super(parent);
  
      this.message = message;
      this.setPreferredSize(new Dimension(300, 150));
  
      progressBar = new JProgressBar(0, max);
      progressBar.setValue(0);
      progressBar.setSize(new Dimension(280, 130));
      progressBar.setString(message + " 0/" + progressBar.getMaximum());
      progressBar.setStringPainted(true);
      this.add(progressBar, BorderLayout.CENTER);
  
      this.pack();
      this.setLocationRelativeTo(parent);
  
      setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
  
  
      }
  
      public void change(int number) {
      ProgressDialog.number = number;
      SwingUtilities.invokeLater(new Runnable() {
  
          public void run() {
          int number = ProgressDialog.getAantal();
          if (number &lt; progressBar.getMaximum() &amp;&amp; number &gt;= 0) {
              progressBar.getModel().setValue(number);
              progressBar.setString(message + " " + progressBar.getValue() + "/" + progressBar.getMaximum());
              System.out.println("progressbar update: " + number + "/" + progressBar.getMaximum());
          } else {
              setCursor(null);
              System.out.println("progressbar terminated");
          }
          }
      });
      }
  
      public static int getAantal(){
      return number;
      }
  }
  </code></pre>
  
  <p>now it still shows the empty window
  but when all pdf's are ready it does show the progressbar with 0% completed
  then it closes (like it should do)</p>
  
  <p>any idea why it stays blank during process?</p>