package profiles.uitest;

/**
 * Questo thread si occupa di aggiornare l'interfaccia grafica ogni
 * updateInterval millisecondi.
 *
 * @author Lorenzo Moretti
 * @version 1.0
 */
public class RepainterThread extends Thread {
  java.awt.Component component = null;
  long updateInterval = 1000;
  boolean stop = false;

  public RepainterThread(java.awt.Component c) {
    component = c;
  }

  public void run() {
    while (!stop) {

      component.repaint();

      try {
        sleep(updateInterval);
      }
      catch (InterruptedException ex) {
      }
    }
  }

  public void stopUpdating() {
    stop = true;
  }
  public long getUpdateInterval() {
    return updateInterval;
  }
  public void setUpdateInterval(long updateInterval) {
    this.updateInterval = updateInterval;
  }
}