Create a text field
Create a read-only text field that allows formatting
1.
Import the
net.rim.device.api.ui.component.RichTextField
class.
2.
Create an instance of a
RichTextField
.
RichTextField rich = new RichTextField("RichTextField");
Create an editable text field that has no formatting and accepts filters
1.
Import the following classes:
•
net.rim.device.api.ui.component.BasicEditField
•
net.rim.device.api.ui.component.EditField
2.
Create an instance of a
BasicEditField
.
BasicEditField bf = new BasicEditField("BasicEditField: ", "",
10, EditField.FILTER_UPPERCASE);
Create an editable text field that allows special characters
1.
Import the
net.rim.device.api.ui.component.EditField
class.
2.
Create an instance of an
EditField
.
EditField edit = new EditField("EditField: ", "", 10,
EditField.FILTER_DEFAULT);
Create a password field
1.
Import the
net.rim.device.api.ui.component.PasswordEditField
class.
2.
Create an instance of a
PasswordEditField
.
For example, the following instance uses a constructor that lets you provide a default initial value for the
PasswordEditField
:
PasswordEditField pwd = new PasswordEditField("PasswordEditField: ", "");
Create a text field for AutoText
1.
Import the following classes:
•
net.rim.device.api.ui.component.AutoTextEditField
•
net.rim.device.api.ui.autotext.AutoText
Development Guide
UI components
20