Check box

Use check boxes for options that BlackBerry® device users can select or clear. Users can select any number of check boxes in a group.

Class CheckboxField
Supported since BlackBerry® Java® SDK 3.7
Example This screen shows check boxes.

For more information about check boxes, see the UI Guidelines.

Code sample: Creating a check box

import net.rim.device.api.ui.Field;
import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.container.MainScreen;
import net.rim.device.api.ui.component.LabelField;
import net.rim.device.api.ui.component.CheckboxField;

public class CheckboxFieldDemo extends UiApplication
{
    public static void main(String[] args) 
    {
        CheckboxFieldDemo theApp = new CheckboxFieldDemo();
        theApp.enterEventDispatcher();
    }
    
    public CheckboxFieldDemo()
    {
        pushScreen(new CheckboxFieldDemoScreen());
    }
}

class CheckboxFieldDemoScreen extends MainScreen
{
    public CheckboxFieldDemoScreen()
    {
        LabelField title = new LabelField("Check Box Demo", 
            LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH);
        setTitle(title);
        
        CheckboxField checkBox1 = new CheckboxField("Ignore Case", true);
        CheckboxField checkBox2 = new CheckboxField("Ignore Acronyms", false);
        add(checkBox1);
        add(checkBox2);
    }
}
Previous topic: Choice fields

Was this information helpful? Send us your comments.