Please send questions to st10@humboldt.edu .
/**
 * our first example of a Java application using a Frame
 *
 *
 * by: Sharon M. Tuttle
 * last modified: 1-29-01
**/

import 	java.awt.*;
import 	java.awt.event.*;

public class GuiApplic1
{
	// this main() method creates a window, adds a label to it, sets its
	// size, and displays it
	public static void main(String args[])
	{
		Frame 		mainFrame;
		Label		welcome, author, version;
		
		// this frame is the window created by this application
		mainFrame = new Frame("Title for mainFrame");

		// note: the default layout manager for a Frame is
		// BorderLayout! CHANGE it if you do not want that;
		mainFrame.setLayout(new FlowLayout());

		// these are simply labels, to start.
		welcome = new Label("Welcome to an Application with a GUI");
		welcome.setForeground(Color.blue);
		mainFrame.add(welcome);   

		author = new Label("Sharon M. Tuttle");
		author.setForeground(Color.black);
		mainFrame.add(author);

		version = new Label("Version 1.2");
		version.setForeground(Color.red);
		mainFrame.add(version);

		// set the frame size to 400 by 400 pixels;
		mainFrame.setSize(400, 400);

		// display the frame
		mainFrame.show();

		// using an anonymous inner class to handle the event that
		// the user has requested that the window be closed 
		// (note that, Morelli, "Java, Java, Java", p. 487:
		// "The WindowAdapter class implements the class of
		// the WindowListener interface.")
		mainFrame.addWindowListener(new WindowAdapter()
			{
				public void windowClosing(WindowEvent e)
				{
					System.exit(0);
				}
			});

		// note that Frame appeared, then disappeared quickly, when
		// I put System.exit(0); here; only doing System.exit(0) when
 		// Frame is closed seems to suffice;		
	}
}