import java.awt.*; import java.awt.event.*; import java.lang.*; import java.lang.Math; public class Test1f extends java.applet.Applet { CheckboxGroup cbg; Checkbox Box0, Box1, Box2; Button Check; Label Response; public void init() { setBackground(new Color(200,200,200)); setLayout(new FlowLayout(FlowLayout.LEFT)); cbg = new CheckboxGroup(); Box0 = new Checkbox("zero", cbg, true); add(Box0); Box1 = new Checkbox("positive", cbg, false); add(Box1); Box2 = new Checkbox("negative", cbg, false); add(Box2); // Check button Check = new Button("Check Answer"); add(Check); Response = new Label("Choose the answer you think is correct", Label.CENTER); add(Response); } public boolean action (Event evt, Object arg) { if (evt.target instanceof Button) { if (cbg.getCurrent().equals(Box0)) { Response.setText("Right! Good answer."); } else { Response.setText("Sorry, that's not correct."); } } else return super.action(evt, arg); return true; } }