title: progress bar when save in java
body: <p>hi I have these lines of codes in java netbeans which save the result of p2 in Result.txt</p>
  
  <pre><code>System.setOut(new PrintStream(new FileOutputStream("Result.txt")));
  String line1;
  Process p2= Runtime.getRuntime().exec(command);
  BufferedReader in = new BufferedReader(new InputStreamReader(p2.getInputStream()) );
  while ((((line1 = in.readLine()) != null))||i&lt;101)
  {
  
     System.out.println(line1);
     i=i+10;
     jProgressBar1.setValue(i);
  
  }
  in.close();
  
  JOptionPane.showMessageDialog(null,"successfull");
  </code></pre>
  
  <p>The code shows me the progress bar only when i=100 that is when the progress bar is filled and the while loop is completed.</p>
  
  <p>I want the code to show me progress bar at 10,20,30,40,50,60,70,80,90,100 while saving.</p>
  
  <p>Thank you.</p>