//Applet Hclock v0.9 - hclock.java


import java.awt.*;
import java.util.*;

public class hclock extends java.applet.Applet implements Runnable
{
  Thread hclockthread;
  Font font;
  String sztemp;
  int size;
  int i;

  public void init()
  {
    sztemp = getParameter("size");
    size = Integer.valueOf(sztemp).intValue();
  
    setBackground(Color.black);
    setForeground(Color.white);
    font = new Font("TimesRoman", Font.PLAIN, size);
    setFont(font);
    
    resize(200,(font.getSize()+8));

    System.out.println("Hclock v0.9 - by Horace Chan");
  }

  public void start()
  {
    if (hclockthread == null)
      hclockthread = new Thread(this, "hclock");
    hclockthread.start();
  }

  public void stop()
  {
    hclockthread.stop();
  }

  public void run()
  {
    while (hclockthread != null)
    {
      repaint();
      try
      {
        hclockthread.sleep(1000);
      } 
      catch (InterruptedException e){}
    }
  }

  public void paint(Graphics g)
  {
    Date now = new Date();
    g.drawString(now.getHours() + ":" + now.getMinutes() + ":" + now.getSeconds(), 4, (font.getSize()+4));
  }
}
