title: Jprogressbar not working
body: <p>I am trying to upload a few files over the network. while uploading it will take an indeterminate time. so wish to display an indeterminate jprogressbar during the upload. The problem, however is that my jprogressbar and upload does not work simultaneously. I tried the upload in a separate thread while keeping the jprogressbar in the EDT. I tried a few different ways. some of them are:
  1) implemented Runnable and in run() I uploaded the file. The progressbar was in the EDT all this time. (did not work.)
  2) had two separate threads and put both upload and progressbar handling in each. (not working). the code for this is :</p>
  
  <pre><code>Thread oThread = new Thread(new Runnable() {
  
     @Override
     public void run() 
     {
          progressBar.setIndeterminate(true);
          progressBar.setVisible(true);
          progressBar.validate();
  
     }
  });
  
  Thread oThread1 = new Thread(new Runnable() 
  {
  
      @Override
      public void run() {
          logger.info("Upload result from ***: "+ newport.upload(textbyte, wavbyte,xmlbyte, filename));
  
          }
      });
  </code></pre>
  
  <p>3) then I rewrote the entire thing and tried a different approach using Executor like this:</p>
  
  <pre><code>executor.execute(new Runnable() {
      @Override
      public void run() {
              upload actions
  
              SwingUtilities.invokeLater(new Runnable() {
                   progBar.setVisible(false);
              });
      }});
  </code></pre>
  
  <p>but none of these techniques worked. I am new to this and am wondering if all this has to be done to have a jprogressbar (indeterminate) displayed. I would like to know if there is a simpler and easier way to do this. </p>