O'Reilly logo

BlackBerry Java Application Development by Bill Foust

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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); ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required