title: Unable to set text in a textfield in java applet in while loop
body: <p>I am trying to make a stopwatch in a java applet.
  The problem is.. I have a text field say "number".
  I take input and then when I press the start button.. flow goes to the below mentioned loop...
  //I use NETBEANS!
  I need that after every 1 second text in the number field must be decresed by one.. but this is not happening.
  Code works fine.. But "0" is displayed after time completition.. and not while the loop is running.  </p>
  
  <pre><code>private void startActionPerformed(java.awt.event.ActionEvent evt) 
  {                                      
      int i = Integer.parseInt(number.getText());
      number.setText(Integer.toString(i));
  
      while(i!=0)
      {
          System.out.print(i);
          //number.setText(Integer.toString(i));
          number.setText("");
          try{Thread.sleep(900);}catch(Exception e){e.getMessage();System.out.println(e);}
          i--;
      }
  }  
  </code></pre>