Would you like to tell us how we are doing?

You bet No thanks

Sorry about the red box, but we really need you to update your browser. Read this excellent article if you're wondering why we are no longer supporting this browser version. Go to Browse Happy for browser suggestions and how to update.

Check boxes

Use check boxes for binary options that users can understand easily. For example, use a check box for an option that can be turned on and off.

Users can perform the following action with a check box:

Action

BlackBerry devices with a trackpad only

BlackBerry devices with a touch screen and a trackpad

Select a check box.

Press the Space key or click the trackpad.

  • Tap the item.
  • Press the Space key.
  • Click the trackpad.

This screen shows a check box.

Best practice: Implementing check boxes

  • Use check boxes when users can select multiple options.

  • Use the check boxField class to create check boxes.

  • Do not start an action when users select a check box. For example, do not open a new screen.

  • Align check boxes vertically.

  • Group and order check boxes logically (for example, group related options together or include the most common options first). Avoid ordering check boxes alphabetically; alphabetical order is language-specific.

Guidelines for labels

  • Use clear, concise labels. Verify that the label clearly describes what occurs when users select the check box.

  • Use positive labels where possible. For example, if users have the option of turning on or turning off a feature, use "turn on" instead of "turn off" in the label.

  • Place labels on the right side of check boxes. On Option screens, place labels on the left side of check boxes.

  • Use sentence case capitalization.

  • Punctuate labels for check boxes with a colon (:).

Code sample: Creating a check box

import net.rim.device.api.ui.*;
import net.rim.device.api.ui.component.*;
import net.rim.device.api.ui.container.*;

//Create the application framework by extending the
//UiApplication class. In main(), create an instance of the
//new class and invoke enterEventDispatcher() to enable the
//application to receive events. In the application
//constructor, invoke pushScreen() to display the custom screen
//for the application. The MyUiScreen class represents the custom screen.
public class MyUi extends UiApplication
{
    public static void main(String[] args)
    {
        MyUi theApp = new MyUi();
        theApp.enterEventDispatcher();
    }
    public MyUi()
    {
        pushScreen(new MyUiScreen());
    }
}

//Create the custom screen for the application by extending the
//MainScreen class. In the screen constructor, invoke
//setTitle() to specify the title for the screen.
class MyUiScreen extends MainScreen
{
    public MyUiScreen()
    {
        setTitle("UI Component Sample");

//In the screen constructor, create a check box by using the
//CheckboxField class. In the CheckboxField constructor, specify
//the label for the check box and use a Boolean value to indicate
//whether the check box is the default selection (for example, true
//indicates that by default the check box is selected). Invoke
//add() to add the check box to the screen.
        add(new CheckboxField("First Check Box", true));
        add(new CheckboxField("Second Check Box", false));
    }

//To override the default functionality that prompts the user to 
//save changes before the application closes, in the extension of the 
//MainScreen class, override the MainScreen.onSavePrompt() method. 
//In the following code sample, the return value is true which 
//indicates that the application does not prompt the user before closing.
    public boolean onSavePrompt()
    {
        return true;
    }
}