Time for action - creating a RadioButtonField

  1. First, add the following code to the createFields method in the FieldSampler application.
    // Create a radio button group RadioButtonGroup rdoGroup = new RadioButtonGroup(); RadioButtonField rdo1 = new RadioButtonField("Radio Field 1"); RadioButtonField rdo2 = new RadioButtonField("Radio Field 2"); RadioButtonField rdo3 = new RadioButtonField("Radio Field 3"); // add the radio buttons to the radio button group. //Adding them to the group is what ensures only one field is selected rdoGroup.add(rdo1); rdoGroup.add(rdo2); rdoGroup.add(rdo3); // Each field must still be added to the screen. // They do not need to be added in the same order as the they were with the group add(rdo3); add(rdo2); add(rdo1); ...

Get BlackBerry Java Application Development now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.