Reset a checkbox groupTag(s): AWT


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

public class radio extends Applet {
  CheckboxGroup cbg;
  public void init() {
    add(new Label("Payment mode?"));
    cbg = new CheckboxGroup();
    add(new Checkbox("Visa", cbg, false));
    add(new Checkbox("Mastercard", cbg, false));
    add(new Checkbox("American Express", cbg, false));
    add(new Checkbox("Cash", cbg, true));
    add(new Button("clear radio"));     
    }

  public boolean action(Event e, Object o) {
    if (o.equals("clear radio")){
       Checkbox current = cbg.getCurrent();
       cbg.setCurrent( null );
       current.setState( false );
       return true;
       }
    return false;
    } 
}

blog comments powered by Disqus