UI components
UI components are the items you can put on a screen. The net.rim.device.api.ui.component package provides a library of prebuilt components and controls.
Add a UI component to a screen
-
Import the following classes:
- net.rim.device.api.ui.component.CheckboxField
- net.rim.device.api.ui.container.MainScreen
-
Create an instance of a UI component, in this example a checkbox.
CheckboxField myCheckbox = new CheckboxField("First checkbox", true); -
Add the UI component to your extension of a Screen class.
mainScreen.add(myCheckbox);
Aligning a field to a line of text
You can align a Field object to the natural beginning of a line of text with the Field.FIELD_LEADING flag. For example, if you create a Field with the alignment flag Field.FIELD_LEADING and add the Field to a VerticalFieldManager, then if the application starts using English or Chinese locales, the Field aligns to the left side of the screen. But if the application starts using Arabic or Hebrew locales, the Field aligns to the right side of the screen.