10 Oct

Tutorial Java ME 2 – Part 1 – Choice Group

Contoh penggunaan Choice Group pada Form Java ME – J2ME

public class ChoiceGroupDemo extends Form {

    public ChoiceGroupDemo() {
        super("ChoiceGroup Demo");
        ChoiceGroup cg1 = new ChoiceGroup("EXCLUSIVE", ChoiceGroup.EXCLUSIVE);
        cg1.append("Pilihan 1", null);
        cg1.append("Pilihan 2", null);
        
        ChoiceGroup cg2 = new ChoiceGroup("MULTIPLE", ChoiceGroup.MULTIPLE);
        cg2.append("Pilihan 1", null);
        cg2.append("Pilihan 2", null);
        
        append(cg1);
        append(cg2);
    }
    
}