Help Center

Local Navigation

Create a dialog box

Use alert dialog boxes to notify users of a critical action such as turning off the BlackBerry® device or an error such as typing information that is not valid. An exclamation point (!) indicator appears in an alert dialog box. To close an alert dialog box, users can click OK or press the Escape key. For more information on other types of dialog boxes, see the API reference for BlackBerry® Java® Development Environment.

  1. Import the net.rim.device.api.ui.component.Dialog class.
  2. Create an alert dialog box specifying the alert text that you want to display.
    Dialog.alert("Specify the alert text that you want to display.")

Drop-down lists

Use drop-down lists to provide a set of mutually exclusive values.

Users can perform the following action with a drop-down list:

Action

BlackBerry devices without a touch screen

BlackBerry devices with a touch screen

Click a value from a drop-down list.

Press the Space key or click the trackwheel, trackball, or trackpad.

Click the screen.

This screen shows a drop-down list.

Best practice: Implementing drop-down lists

  • Use a drop-down list for two or more choices when space is an issue. If space is not an issue, consider using option buttons instead so that users can view the available options on the screen.
  • Use the ObjectChoiceField class to create drop-down lists.
  • For the default value, use the value that users are most likely to click.
  • Use the highlighted option as the default focus when users scroll through the list.
  • If users are not required to click a value, include a "None" value in the drop-down list. Always place the "None" value at the top of the list.
  • Group and order values logically (for example, group related values together or include the most common values first). Avoid ordering values alphabetically; alphabetical order is language specific.

Guidelines for labels

  • Use clear, concise labels for drop-down lists and for the values in drop-down lists. Verify that the label clearly describes what occurs when users click the value. The width of the drop-down list changes based on the length of the value labels. If a label is too long, an ellipsis (...) appears to indicate that the text is truncated.
  • Place the label on the left side of a drop-down list.
  • Use title case capitalization for drop-down list labels and for the value labels in a drop-down list.
  • Punctuate labels for drop-down lists with a colon (:).

Was this information helpful? Send us your comments.