How to get Value of CheckBox in GXT


        CheckBox check1 = new CheckBox(); 
        check1.setBoxLabel("Brochures"); 
        check1.setValueAttribute("Bro"); 

        CheckBox check2 = new CheckBox(); 
        check2.setBoxLabel("Events"); 
        check2.setValue(true); 
        check2.setValueAttribute("Ev"); 

        CheckBox check3 = new CheckBox(); 
        check3.setBoxLabel("Announcements"); 
        check3.setValue(true); 
        check3.setValueAttribute("Ann"); 

        final CheckBoxGroup checkGroup = new CheckBoxGroup(); 
        checkGroup.setFieldLabel("Subscribe"); 
        checkGroup.add(check1); 
        checkGroup.add(check2); 
        checkGroup.add(check3); 
        fp.add(checkGroup); 


        Button click = new Button("click"); 
        click.addSelectionListener(new SelectionListener<ButtonEvent>() { 

            @Override 
            public void componentSelected(ButtonEvent ce) { 

                String info = ""; 
                List<CheckBox> values = checkGroup.getValues(); 
                for (CheckBox checkBox : values) { 
                    info += "<br>" + checkBox.getBoxLabel() + ": " + checkBox.getValueAttribute() + " " + checkBox.getValue(); 
                } 

                MessageBox.alert("title", info, null); 
            } 
        });  


你可能感兴趣的:(FP)