
/**
	AUTHOR: Anthony Hand

	DATE: October 1998

	URL
		http://www.handaweb.com/anthony/coursework/

	SUMMARY:
 		This is a simple, throwaway, fun applet to demonstrate Java Beans
 		principles through the getXXX/setXXX methods.

   INPUT (this class):
		o Enter text into the text field and hit enter.
		
   BAD DATA CHECKING:
		o N/A

   OUTPUT:
		o Creates a popup window with the entered message.

   CLASS HIERARCHY:
        Object
        |
        +---Component
            |
            +---Container
                |
                +---Panel
                |   |
                |   +---Applet
                |       |
                |       +---HelloFred
                |
                +---Window
                    |
                    +---Frame
                        |
                        +---FredWin

	NOTES
	    o This applet was done just for fun in about 10 minutes. (Commenting
	      and things added later.) 
*/

import java.awt.*;
import java.applet.*;

public class HelloFred extends Applet
{
	//{{DECLARE_CONTROLS
	java.awt.Label bannerLbl = new java.awt.Label();
	java.awt.Label enterLbl = new java.awt.Label();
	java.awt.TextField enterTF = new java.awt.TextField();
	//}}

	public void init()
	{
		//{{INIT_CONTROLS
		setLayout(null);
		setBackground(new java.awt.Color(0,0,51));
		setFont(new Font("SansSerif", Font.PLAIN, 12));
		setSize(356,187);
		bannerLbl.setText("Hello, Fred");
		add(bannerLbl);
		bannerLbl.setForeground(java.awt.Color.green);
		bannerLbl.setFont(new Font("Dialog", Font.PLAIN, 36));
		bannerLbl.setBounds(12,12,396,47);
		enterLbl.setText("C\'mon, think of something zany...");
		add(enterLbl);
		enterLbl.setForeground(java.awt.Color.green);
		enterLbl.setFont(new Font("Dialog", Font.PLAIN, 18));
		enterLbl.setBounds(12,84,324,30);
		add(enterTF);
		enterTF.setBackground(java.awt.Color.lightGray);
		enterTF.setFont(new Font("MonoSpaced", Font.PLAIN, 24));
		enterTF.setBounds(12,120,324,30);
		//}}
	
		//{{REGISTER_LISTENERS
		HelloFredAction helloFredAction = new HelloFredAction();
		enterTF.addActionListener(helloFredAction);
		//}}
	}
	
	
	//**********************************************************
	// Event Handling methods
	//
	class HelloFredAction implements java.awt.event.ActionListener
	{
		public void actionPerformed(java.awt.event.ActionEvent event)
		{
			Object object = event.getSource();
			if (object == enterTF)
				enterTF_EnterHit(event);
		}
	} //HelloFredAction

	void enterTF_EnterHit(java.awt.event.ActionEvent event)
	{
		// Create and show the Frame
		FredWin fredWin = new FredWin();
		fredWin.setSezLbl(enterTF.getText());
		fredWin.setVisible(true);
	} //enterTF_EnterHit
	
} //HelloFred
