// The HelloWorld2 Applet - Allows the modification of the parameters
// that are displayed in the applet.

import java.awt.Graphics;
import java.applet.Applet;

public class HelloWorld2 extends Applet
{
	
	// The class states - declared here so that the parameters can be passed from 
	// the init() method to the paint() method. These states are given default values
	// of World to be displayed at (10,10)
	
	private String theDisplayString = "World";
	private int theStartx = 10;
	private int theStarty = 10;
	
	public void init()
	{
		// try to read in the parameters from the HTML file
	
		String tempName = this.getParameter("displayName"); 
		String tempXString = this.getParameter("startx");
		String tempYString = this.getParameter("starty");
		
		// check to see if any of the parameters are blank

		if ((tempName!=null)&&(tempXString!=null)&&(tempYString!=null))
		{
			// OK - none of the parameters are blank 
			// the HTML author did their job properly

			this.theDisplayString = tempName;
			
			// convert the (X,Y) strings received into integer values.
			this.theStartx = (new Integer(tempXString)).intValue();
			this.theStarty = (new Integer(tempYString)).intValue();
		}
	}
	
	public void paint(Graphics g)
	{
		g.drawString("Hello "+theDisplayString+"!",theStartx,theStarty);
	}
}
