//======================================================================
//	PROJECT:		_programming.java_
//	FILE:			Gigobite.java
//	PURPOSE:		Chapter 3 lablet
//	VERSION:		1.1
//	TARGET:		Java v1.1
//	UPDATE HISTORY:	1.1	9/8/98 new documentation and 1.1 compliance
//				1.0	8/21/96 the version in _p.j_
//======================================================================

//------------------------------ IMPORTS -------------------------------
/*
	Since we're not responding to any of the events generated by
	the widgets (that'll come soon, in Chapter 6), we don't need to 
	import the java.awt.event package.
*/
import java.applet.*;
import java.awt.*;

//=========================== Gigobite CLASS ==========================
/**
 * The user interface of an on-line order form.  Think of this lablet as
 * the first third of a working order form--we do the layout here and 
 * later will extend this class so that it responds to events.  The last
 * third,in which the applet would communicate the order back to the 
 * restaurant's computer, is beyond the scope of the text.
 *
 * Note that all we have here is an init() method--we don't need the
 * "implements ActionListener" clause in the class header, we don't
 * need an actionPerformed() method, and we don't need a paint()
 * method.
 */
public class Gigobite extends Applet 
{
	//------------------------------ DATA ----------------------------
	
	Checkbox superSize = new Checkbox("Super Size?");
	
	TextField reminder = new TextField("Ask for Coupons!",18);
	
 	List sandwiches =	new List(5,true);
  	List drinks = 		new List(5, true);
  	List sides = 		new List(3, false);
  	
  	Choice sizes = new Choice();
  	
 	TextArea comments = new TextArea("Hold the pickles!", 2, 10);
 	
 	Button order = new Button("Place Order");
 	
  	Label sandsLabel = new Label("Sandwiches");
  	Label drinkLabel = new Label("Drinks");
  	Label sidesLabel = new Label("Side Orders");
  	Label title = new Label("Gigo-BITES");
  	
  	Font myFont1 = new Font("Serif",Font.BOLD,36);
  	Font myFont2 = new Font("Serif",Font.ITALIC,12);
	
	//---------------------------- METHODS ---------------------------
  
  	/**
  	 * Initialize all of the widgets and add them to the applet.
  	 */
  	public void init() 
  	{
     	//----- Place the items in the sandwich List object.
     	
	    sandwiches.add("Hamburg");
	    sandwiches.add("Cheeseburg");
	    sandwiches.add("1/4-pound");
	    sandwiches.add("1/2-pound");
	    sandwiches.add("Side O' Beef");
        
	    //----- Place the items in the side order List object.
     	
	    sides.add("Fries");
	    sides.add("Baked");
	    sides.add("Chips");
        
	    //----- Place the items in the drinks List object.
		
	    drinks.add("Cola");
	    drinks.add("Root Beer");
	    drinks.add("Coffee");
	    drinks.add("Shake");
	    drinks.add("Milk");
 
	    //----- Place the items in the size Choice object.
     	
	    sizes.add("Small");
	    sizes.add("Medium");
	    sizes.add("Large");
		
	    //----- Set the applet's background color and size.
		
	    setBackground(Color.yellow);
	    setSize(450,300);	// We don't really need this
				// we include it here so you can see 
				// what happens to the layout when
				// you change the applet's size.
  		
	    //----- Adjust the properties of some of the widgets.
		
	    sandsLabel.setFont(myFont2);  
	    drinkLabel.setBackground(Color.cyan);
	    sidesLabel.setForeground(Color.red);
	    title.setFont(myFont1);
	    title.setForeground(Color.blue); 
        
	    //----- Add all of the widgets to our applet.
     	
	    add(sandsLabel);
	    add(sandwiches);
	    add(drinkLabel);
	    add(drinks);
	    add(sidesLabel);
	    add(sides);
	    add(comments);
	    add(sizes);
	    add(superSize);
	    add(reminder);
	    add(order); 
	    add(title);
	}
}
