title: Java Swing: JProgressBar is not showed
body: <p>Following <a href="http://www.java2s.com/Code/Java/Swing-JFC/ProgressbarSample.htm" rel="nofollow">this</a> guide I want to add a JProgressBar in my application while a long PDF document is being created after the apposite button is pressed. This is a skeleton of my method:</p>
  
  <pre><code>/* asking data to database and getting a list of Objects */
  JFrame frameBar = new JFrame("Avanzamento");
  
  Container content = frameBar.getContentPane();
  JProgressBar progressBar = new JProgressBar();
  progressBar.setValue(0);
  progressBar.setStringPainted(true);
  Border border = BorderFactory.createTitledBorder("Creazione report PDF in corso");
  progressBar.setBorder(border);
  content.add(progressBar);
  frameBar.setSize(600, 200);
  frameBar.setVisible(true);
  
  int length = results.getProtocolloList().size();
  
  for (int j = 0; j &lt; length; j++) {
  
  /* print object j-th in a table into the PDF Document */
  progressBar.setValue((length / 100)*j);
  
  Thread.sleep(1000);
  
  }
  
  frameBar.setVisible(false);
  frameBar.dispose();
  </code></pre>
  
  <p>Anyway nothing is showed in the frameBar, what I see is just a blank window without anything. 
  Do you know where am I making the mistake?</p>