import java.awt.*;
import java.applet.*;

public class SampleCheckboxes2
extends      Applet
{
    TextField output;
    Checkbox  box1;
    Checkbox  box2;
    Checkbox  box3;

    public void init() {
        setLayout( new GridLayout( 4, 1 ) );

        output = new TextField("red balloon",40);               add(output);
        output.setEditable(false);

        CheckboxGroup group = new CheckboxGroup();
        box1    = new Checkbox( "Big",   group, false );        add(box1);
        box2    = new Checkbox( "Red",   group, true  );        add(box2);
        box3    = new Checkbox( "Shiny", group, false );        add(box3);
    }

    public boolean action( Event e, Object what ) {
        boolean result = super.action( e, what );
        if (e.target == box1
        ||  e.target == box2
        ||  e.target == box3
        ){
            String s1 = (box1.getState() ? "big "   : "");
            String s2 = (box2.getState() ? "red "   : "");
            String s3 = (box3.getState() ? "shiny " : "");
            String s  = s1 + s2 + s3 + "balloon";
            output.setText(s);
        }
        return result;
    }
}

