</COMMENT>
/*
	Choice.java - Cory Goldfuss - October 19, 2000
	Program allows the user to change the color of the background
	in the applet. 
	* 31 Jan 2002 - Got around to fixing my Java programs...removed
	  Symantec anything, so now it works.
 */

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


public class Choice extends Applet implements ItemListener
{
	public void init()
	{
		// Take out this line if you don't use symantec.itools.net.RelativeURL or symantec.itools.awt.util.StatusScroller
		//symantec.itools.lang.Context.setApplet(this);
	
		// This code is automatically generated by Visual Cafe when you add
		// components to the visual environment. It instantiates and initializes
		// the components. To modify the code, only use code syntax that matches
		// what Visual Cafe can generate, or Visual Cafe may be unable to back
		// parse your Java file into its visual environment.
		//{{INIT_CONTROLS
		setLayout(null);
		setBackground(java.awt.Color.blue);
		setSize(426,266);
		colorChoice.addItem("Red");
		colorChoice.addItem("Blue");
		colorChoice.addItem("Black");
		colorChoice.addItem("Orange");
		colorChoice.addItem("White");
		colorChoice.addItem("Green");
		colorChoice.addItem("Gray");
		colorChoice.addItem("Pink");
		colorChoice.addItem("Black and Orange");
		try {
			colorChoice.select(0);
		}
		catch (IllegalArgumentException e) { }
		add(colorChoice);
		colorChoice.setBounds(132,96,151,21);
		instructionsLbl.setText("Use pull down menu to change color of background");
		instructionsLbl.setAlignment(java.awt.Label.CENTER);
		add(instructionsLbl);
		instructionsLbl.setBackground(java.awt.Color.white);
		instructionsLbl.setBounds(60,24,300,36);
		//}}
	    colorChoice.addItemListener( this );
	}
	
	//{{DECLARE_CONTROLS
	java.awt.Choice colorChoice = new java.awt.Choice();
	java.awt.Label instructionsLbl = new java.awt.Label();
	//}}

	public void itemStateChanged( ItemEvent e ){
	       
	    int index;
	    index = colorChoice.getSelectedIndex();
	    
	    if ( e.getSource() == colorChoice){
	        switch ( index ){
	            case 0: // Red
	               instructionsLbl.setText("Index is 0");
	               setBackground(java.awt.Color.red);
	               break;
	            case 1: // Blue
	               instructionsLbl.setText("Index is 1");
	               setBackground(java.awt.Color.blue);
	               break;
	            case 2: // Black
	               instructionsLbl.setText("Index is 2");
	               setBackground(java.awt.Color.black);
	               break;
	            case 3: // Orange
	               instructionsLbl.setText("Index is 3");
	               setBackground(java.awt.Color.orange);
	               break;
	            case 4: // White
	               instructionsLbl.setText("Index is 4");
	               setBackground(java.awt.Color.white);
	               break;
	            case 5: // Green
	               instructionsLbl.setText("Index is 5");
	               setBackground(java.awt.Color.green);
	               break;
	            case 6: // Gray
	               instructionsLbl.setText("Index is 6");
	               setBackground(java.awt.Color.gray);
	               break;
	            case 7: // Pink
	               instructionsLbl.setText("Index is 7");
	               setBackground(java.awt.Color.pink);
	               break;
	            case 8: // Joke
	               instructionsLbl.setText("Happy Halloween!");
	               setBackground(java.awt.Color.orange);
	              
	               
	               
	               
	        }// end switch
	    }// end if
	    repaint(); // Change color of background
	}// end method
}// end applet