// The "Shapechoice" class.
import java.applet.*;
import java.awt.*;

public class Shapechoice extends Applet
{
    Button rr = new Button("red rectangle"),
	   br = new Button("blue rectangle"),
	   ro = new Button("red oval"),
	   bo = new Button("blue oval");
	   TextField input = new TextField("Choose one");
    
    
    public void init ()
    {
	add(rr);
	add(br);
	add(input);
	add(ro);
	add(bo);
    } // init method
    
    public boolean action(Event e, Object o)
    {
	Graphics gr = getGraphics();
	if(e.target == rr)
	{
	    gr.setColor(Color.red);
	    gr.fillRect(20,10,40,50);
	}
	else if (e.target == br)
	{
	    gr.setColor(Color.blue);
	    gr.fillRect(20,40, 50,80);
	}
	else if (e.target == ro)
	{
	    gr.setColor(Color.red);
	    gr.fillOval(40,60,50,80);
	}
	else if (e.target == bo)
	{
	    gr.setColor(Color.blue);
	    gr.fillOval(40,80,80,100);
	}
	return true;
     }
    
    public void paint (Graphics g)
    {
	// Place the body of the drawing method here
    } // paint method
} // Shapechoice class

