Examples of XCheckboxGroup


Examples of next.i.view.widgets.XCheckboxGroup

    XCheckbox check0 = new XCheckbox("Red", "Red");
    XCheckbox check1 = new XCheckbox("Green", "Green");
    XCheckbox check2 = new XCheckbox("Blue", "Blue");

    final XCheckboxGroup groupVertical = new XCheckboxGroup(true);
    groupVertical.add(check0, check1, check2);

    XCheckbox checkA = new XCheckbox("Red", "Red");
    XCheckbox checkB = new XCheckbox("Green", "Green");
    XCheckbox checkC = new XCheckbox("Blue", "Blue");
    final XCheckboxGroup groupHorizontal = new XCheckboxGroup(false);
    groupHorizontal.add(checkA, checkB, checkC);

    final XLabel label1 = new XLabel("Favorite color", XLabelType.Header);
    final XLabel label2 = new XLabel("Favorite color", XLabelType.Header);

    panel.addWidgets(label2, groupHorizontal, label1, groupVertical, new HTML(" "));

    check0.setValue(true);
    check1.setValue(true);
    checkA.setValue(true);
    checkC.setValue(true);
   
    groupVertical.addSelectionChangedHandler(new SelectionChangedHandler() {
      public void onSelectionChanged(SelectionChangedEvent e) {
        String s = "Favorite color: ";
        for (XCheckbox c : groupVertical.getCheckedWidgets()) {
          s += c.getName() + ", ";
        }
        label1.setText(s);
      }
    });

    groupHorizontal.addSelectionChangedHandler(new SelectionChangedHandler() {
      public void onSelectionChanged(SelectionChangedEvent e) {
        String s = "Favorite color: ";
        for (XCheckbox c : groupHorizontal.getCheckedWidgets()) {
          s += c.getName() + ", ";
        }
        label2.setText(s);
      }
    });
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.