import java.applet.Applet;  // need to inherit from built-in Applet
import java.awt.*;          // Window I/O routines

// Dilip Barman  October 6, 1997
// file helloWorldApplet.java
// This is my first java applet, now that I've got "Hello, World!" to work as an application.
// Since this is an applet, it is meant to be run in a web browser.  First we compile
// the applet (javac helloWorldApplet.java) to get helloWorldApplet.class.  We can
// try it out via appletviewer (appletviewer helloWorldApplet.java) (note file type .java!
// this isn't consistent with how we call from html or how we call an application!)
// or call it from an html page that has tags that look like:
//    <applet code="helloWorldApplet.class" width=50 height=50>
//      <param name=Size value="medium">  
//    </applet>
// Of course, here we have no parameters, so we skip the second line.


public class helloWorldApplet extends Applet
// We inherit from Applet

{

  // Instance and class variable definitions - we just have two class variables
  Font appletFont;   
  int  numInstances = 0;
  
  // Now we define methods.  Applets look for 4 methods - init, start, stop, and destroy
  // init() is called when the applet is loaded, start() when it starts execution (i.e.,
  // right after init() and whenever we revisit this web page), stop() when we leave this
  // web page, and destroy() when we leave the browser.

  public void init()
  {
    System.out.println ("Hello, World!\n");
    // Above just prints to console; we need awt routines to print to web page
    //    appletFont = new Font ("Helvetica", Font.BOLD, 14);  define font
  } 

  public void start()
  {
    System.out.println ("Starting applet ... time number " + ++numInstances + ".\n");
    // + is concatenation operator and ++, of course, is increment
  }

  public void stop()
  {
    System.out.println ("Stopping applet\n");
  }

  public void destroy()
  {
    System.out.println ("Destroying applet execution instance\n");
  }

}  // end class definition

