title: Can't update JLabels of minutes and hours for my chronometer in java.swing
body: <p>I'm trying to make a stopwatch with java.swing and a stopwatch
  I have already tried the swing.Timer and TimerTask.
  <em>Could you help me?</em></p>
  <p>This is the stopwatch.java class</p>
  <pre><code>    public class Cronometro {
      private int secondi;
      private int minuti;
      private int ore;
      private boolean state=true;
      
      public Cronometro(){
          
      }
      
      public void crono(JLabel s, JLabel m, JLabel h, ActionEvent evt){
          state=true;
          
          Thread t = new Thread(){
              public void run(){
                  for(;;){
                      if(state==true){
                         try{
                             sleep(10);
                             secondi++;
                             if(secondi&gt;60){
                                 secondi=0;
                                 minuti++;
                                 
                             }
                             if(minuti&gt;60){
                                 secondi=0;
                                 minuti=0;
                                 ore++;
                             }
                             s.setText(&quot; :&quot;+secondi);
                             m.setText(&quot; : &quot;+minuti);
                             h.setText(&quot;&quot;+ore);
                         } catch(Exception e){
                             
                         }
                      }
                      else{
                          break;
                      }
                  }
              }
          };
          
          t.start();
      }
      
      public void setState(boolean state){
          this.state=state;
      }
      
  }
  </code></pre>
  <p>The gui/main.java was generated almost all by netbeans</p>