FileDocCategorySizeDatePackage
EventChoice.javaAPI DocExample1125Tue Nov 27 10:37:04 GMT 2001None

EventChoice

public class EventChoice extends Applet implements ItemListener

Fields Summary
private Choice
ch1
private Choice
ch2
private String
chChoice
Constructors Summary
Methods Summary
public voidinit()

	   
	
		ch1 = new Choice();
		ch2 = new Choice();
		ch1.add("Sunday");
		ch1.add("Monday");
		ch1.add("Tuesday");	
		ch1.add("Wednsday");
		ch1.add("Thursday");
		ch1.add("Friday");	
		ch1.add("Saturday");	
		ch1.addItemListener(this);
		add(ch1);
		ch2.add("Spring");	
		ch2.add("Summer");
		ch2.add("Autumn");	
		ch2.add("Winter");
		ch2.addItemListener(this);
		add(ch2);
	
public voiditemStateChanged(java.awt.event.ItemEvent ie)

	  if (ie.getSource()==ch1)
	  {
	  	chChoice = "It was " + ie.getItem().toString();
	  }
	  repaint();
	
public voidpaint(java.awt.Graphics g)

		g.drawString(chChoice, 50, 60 );