

import java.awt.*;
import java.applet.Applet;
import java.util.*;

/** 
 * An applet to provide a simple language tutor. 
 * @author matth3wbishop<at>yahoo!<dot>com
 */
public class TutorApplet extends Applet
{

  //-------------------------------------------------
  private Date startTime;
  //-------------------------------------------------
  private Date initializeTime;
  //-------------------------------------------------
  private Date stopTime;
  //-------------------------------------------------
  private Date destroyDate;
  //-------------------------------------------------
  private TutorPanel pnlTutor;
  //-------------------------------------------------
  Color backgroundColour;


  //-------------------------------------------------
  /** initialize method */
   public void init() 
   {
     this.initializeTime = new Date();
     System.out.println("init method of TutorApplet");

     pnlTutor = new TutorPanel();
     setLayout(new java.awt.GridLayout(1,0));

     this.add(pnlTutor);
     validate();

   } //-- method: init

  //-------------------------------------------------
   public void start() 
   {
     this.startTime = new Date();
     System.out.println("start method of TutorApplet");
   }

  //-------------------------------------------------
   public void stop() 
   {
     this.stopTime = new Date();
     System.out.println("stop method of TutorApplet");
   }

  //-------------------------------------------------
   public void destroy() 
   {
     System.out.println("destroy method of TutorApplet");
   }

  //-------------------------------------------------
   void addItem(String newWord) 
   {
     repaint();
   }

  //-------------------------------------------------
    /*
    public void paint(Graphics g)
    {
       //Draw a Rectangle around the applet's display area.
       g.drawRect(0, 0, size().width - 1, size().height - 1);

	//Draw the current string inside the rectangle.
        g.drawString(buffer.toString(), 5, 15);
    }
    */

  //-------------------------------------------------
    public boolean mouseDown(Event event, int x, int y) 
    {
      addItem("click!... " + x);
      return true;
    }

//--------------------------------------------
  /** A main method to do some testing */
  public static void main(String[] args) throws Exception
  {
    StringBuffer sbUsageMessage = new StringBuffer("");
    sbUsageMessage.append("usage: java TutorApplet []");
    //sbUsageMessage.append(NEWLINE); 

    if (args.length == 0)
    {	    
      System.out.println(sbUsageMessage);
      System.exit(-1);
    }

    Frame frame = new Frame("Testing TutorPanel");
    TutorApplet appletTest = new TutorApplet();
    frame.add("Center", appletTest);
    frame.pack();
    frame.show();
      
  } //-- main()        
} //-- class: TutorApplet

