import jcontrol.lang.ThreadExt;
import jcontrol.system.Time;
import jcontrol.ui.vole.Border;
import jcontrol.ui.vole.Frame;
import jcontrol.ui.vole.meter.AnalogClock;

/**
 * <p>This example demonstrates how to use the
 * component AnalogClock within the GUI framework
 * JControl/Vole.</p>
 *
 * <p>(C) DOMOLOGIC Home Automation GmbH 2003-2005</p>
 */
public class VoleAnalogClockExample extends Frame {
  
  /**
   * Create and continuosly update an AnalogClock
   */
  public VoleAnalogClockExample() {
    // create a new AnalogClock
    AnalogClock ac = new AnalogClock(35, 7, 26, true);
    this.add(ac);
    
    // add a border
    this.add(new Border("Analog Clock", 26, 0, 70, 64));
    
    // make us visible
    show();
    
    // update the AnalogClock's time once a second 
    for (;;) {
      Time t = new Time();
      ac.setValue(t.hour, t.minute, t.second);
      try { 
        ThreadExt.sleep(1000); 
      } catch (InterruptedException e) {}
    }      
  }

  /**
   * Instantiate the example
   */
  public static void main(String[] args) {
    new VoleAnalogClockExample();
  }
}
