Skip to content

Instantly share code, notes, and snippets.

@codenameone
Created February 8, 2016 13:23
Show Gist options
  • Save codenameone/dc7fccf13dc102bc5ea0 to your computer and use it in GitHub Desktop.
Save codenameone/dc7fccf13dc102bc5ea0 to your computer and use it in GitHub Desktop.
Simple sample of using RadioButton & CheckBox in Codename One
CheckBox cb1 = new CheckBox("CheckBox No Icon");
cb1.setSelected(true);
CheckBox cb2 = new CheckBox("CheckBox With Icon", icon);
CheckBox cb3 = new CheckBox("CheckBox Opposite True", icon);
CheckBox cb4 = new CheckBox("CheckBox Opposite False", icon);
cb3.setOppositeSide(true);
cb4.setOppositeSide(false);
RadioButton rb1 = new RadioButton("Radio 1");
RadioButton rb2 = new RadioButton("Radio 2");
RadioButton rb3 = new RadioButton("Radio 3", icon);
new ButtonGroup(rb1, rb2, rb3);
rb2.setSelected(true);
hi.add(cb1).add(cb2).add(cb3).add(cb4).add(rb1).add(rb2).add(rb3);
@codenameone
Copy link
Author

Sample usage code for CheckBox & RadioButton.

From the Codename One project

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment