ProgressMonitor.java :  » Swing-Library » thinlet » thinlet » drafts » Java Open Source

Java Open Source » Swing Library » thinlet 
thinlet » thinlet » drafts » ProgressMonitor.java
package thinlet.drafts;

import thinlet.*;

public class ProgressMonitor implements Runnable {
  
  public void start(Thinlet thinlet) throws Exception {
    thinlet.add(thinlet.parse("progressdialog.xml", this));
  }
  
  private Thinlet thinlet;
  private Object dialog, status, progressbar;
  
  public void init(Thinlet thinlet, Object dialog, Object status, Object progressbar) {
    this.thinlet = thinlet;
    this.dialog = dialog; this.status = status; this.progressbar = progressbar;
    new Thread(this).start();
  }

  public void run() {
    for (int i = 1; i <= 10; i++) {
      thinlet.setString(status, "text", "Completed " + i + " out of 10.");
      thinlet.setInteger(progressbar, "value", i * 10);
      try {
        Thread.sleep(450);
      } catch (InterruptedException ie) {}
    }
    thinlet.remove(dialog);
  }
  
  public void close(Thinlet thinlet, Object dialog) {
    thinlet.remove(dialog);
  }
  
  public void cancel(Thinlet thinlet, Object dialog) {
    thinlet.remove(dialog);
  }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.