ProgressMonitor or ProgressBar for monitoring multiple xml files upload
<p>I am trying to find a way if possible, of displaying a progressBar or progressMonitor while reading a huge number of xml files for making a spreadsheet of files to modify without the user having to open every single xml file and modify the content which might seem complex the user, that I have done and its working fine now I m stuck with show a progressBar to user unlike making the user wait with nothing indicating that something is in progress, when uploading many files, it takes close to ten seconds or more. Your shedding of some light is highly appreciated, thank you in advance.</p>

<pre><code>  public Vector&lt;Vector&lt;SpreadSheetCell&gt;&gt; returnDynamicTrees(int h,int w) 
      {
          //Display thread shows the JProgress Bar for this time consuming method  
          new Thread(new display()).start();

          long ready = System.currentTimeMillis();
          System.out.println("Taking time ?");
           Vector&lt;Vector&lt;SpreadSheetCell&gt;&gt; dynamicTrees = new Vector&lt;Vector&lt;SpreadSheetCell&gt;&gt;();

          Vector&lt;String&gt; columns= columnHeaders(0,validDocs.size(),rootName);


         //Data reading here. 
         //This where too much delay is happening



         //I thought of putting this for loop in a thread 
         for(int j=0;j&lt;fileNames.length;j++)
         {               
            dynamicTrees.add(new Vector&lt;SpreadSheetCell&gt;());
            for(int i=0;i&lt;columns.size();i++)
            {
                dynamicTrees.elementAt(j).add(new SpreadSheetCell(directoryPath+"/"+fileNames[j],columns.get(i),i,j,h,w));

            }  
         }


             long done= System.currentTimeMillis();
          System.out.println(set);          
         System.out.println("Execution time for ReturnDynamicTree "+(done-ready)+" ms.");
         return dynamicTrees;

      }

       //////Method for display JProgressBar
       public static void displayProgressBar()
       {
        frame.setSize(300, 100); //Window size 300x100 pixels
        pane = frame.getContentPane();//Pane is a Container
        pane.add(bar);
        bar.setBounds(20, 20, 20, 20);  //Bar is JProgressBar     
        frame.setResizable(false);
        frame.setVisible(true);
        frame.setLocationRelativeTo(null);
        frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);

        new Thread(new Repaint()).start();

       }


       static class Repaint implements Runnable{
         public void run(){
            for (int i=0; i&lt;=100; i++){ //Progressively increment variable i
               bar.setValue(i); //Set value
               bar.repaint(); //Refresh graphics

               try{Thread.sleep(10);} //Sleep 50 milliseconds

                  catch (InterruptedException err){}
               System.out.println();             
            }

         }
      }
       //Thread for running displayProgressBar in a thread to avoid more delay
      static class display implements Runnable{
          public void run(){
            displayProgressBar();
            frame.repaint();
            }
         }
</code></pre>
