title: updating label text dynamically in Java Swing
body: <p>I am creating a simple download manager in Java swing...!
  I have used different threads for different tasks in the download manager.</p>
  
  <p>Thread1-> main
  Thread2-> downloadSpeedTracker
  Thread3-> SwingUIRendrer</p>
  
  <p>In this application I am calculating the download speed by creating a thread in class downloadSpeedTracker and I am recalculating this speed after every second. I have created Thread3 in SwingUIRendrer class. Now I want to send this calculated speed to my SwingUIRendrer class.</p>
  
  <p>I want to continuously update this calculated speed on the SwingUI.
   How do I achieve this...?</p>
  
  <hr>
  
  <p>@Mohamed:</p>
  
  <pre><code>public void setUI(int speed)
  {
      JLabel l1= new JLabel("Speed :"+speed);
      wind.add(l1); 
      wind.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 
      wind.setSize(200, 60);
  }
  </code></pre>
  
  <p>I am calling the <code>SetUI</code> method in a while loop. Everytime the method is called, a new value for speed is sent to it; but when I run the program, the speed is getting overwritten on the earlier displyed speed. I want to clear the earlier value of speed from the UI and then write the new one.</p>