title: Counting and printing time in java using swing
body: <p>I'm trying to implement a timer using one thread and print it on a JButton using another thread.
  my class for time is like this:</p>
  
  <pre><code>public class Time extends Thread 
  {
  int counter = 0;
  public String currentTime = new String();
  
  
  public String printFormat(int second)
  {
      return String.format("%d:%d", second/60, second%60);
  }
  
  synchronized public void count(int minute) throws InterruptedException
  {
      minute *= 60;
      while(minute &gt;= 0)
      {
          wait(1000);
          minute--;
          currentTime = printFormat(minute);
          System.out.println(currentTime);
      }
  
  }
  </code></pre>
  
  <p>and my main thread is like this:</p>
  
  <pre><code>     button.setText(time.currentTime);
  </code></pre>
  
  <p>what is wrong with this piece of code?</p>