The
net.rim.device.api.ui package contains the fundamental classes that are used for all UI applications:
-
Field: A rectangular area that can be drawn on the screen of a device.
-
Manager: An area that contains other UI components and handles layout and scrolling behavior.
-
Screen: A drawable area that is pushed on to and popped off of an application's display stack.
For convenience, the
net.rim.device.api.ui.component package contains prebuilt UI components such as the following:
For more information about the classes in the
net.rim.device.api.ui.component package, see
UI components.
The
net.rim.device.api.ui.container package contains classes that you can use to arrange UI components on a screen, such as:
Button -
ButtonField mySubmitButton = new ButtonField("Submit");
CheckBox -
CheckboxField chk=new CheckboxField("First Check Box", true);
CheckboxField chk=new CheckboxField("First Check Box", false);
DialogBox -
Dialog.alert("Specify the alert text that you want to display.")
LabelField -
LabelField title = new LabelField("UI Component Sample", LabelField.ELLIPSIS);
RadioButton -
RadioButtonGroup rbg = new RadioButtonGroup();
add(new RadioButtonField("Option 1",rbg,true));
add(new RadioButtonField("Option 2",rbg,false));
DateTimePicker -
DateTimePicker datePicker = DateTimePicker.getInstance();
datePicker.doModal();
Calendar cal = datePicker.getDateTime();
Date date = cal.getTime();
Dialog.alert("You selected " + date.toString());
FilePicker -
FilePicker fp = FilePicker.getInstance();
FilePickListener fileListener = new FilePickListener();
fp.setListener(fileListener);
fp.show();
class FilePickListener implements FilePicker.Listener
{
public void selectionDone(String str)
{
Dialog.alert("You selected " + str);
}
}
Text Fields -
RichTextField rich = new RichTextField("RichTextField");
BasicEditField bf = new BasicEditField(
"BasicEditField: ", "", 10, EditField.FILTER_UPPERCASE);
EditField edit = new EditField(
"EditField: ", "", 10, EditField.FILTER_DEFAULT);
AutoTextEditField autoT = new AutoTextEditField(
"AutoTextEditField: ", "");
PasswordEditField pwd = new PasswordEditField("PasswordEditField: ", "");