Editable text field

Use an editable text field to allow BlackBerry® device users to type text in a field. You can apply filters to restrict the characters that users can type in the text field.

Class BasicEditField
Supported since BlackBerry® Java® SDK 3.7
Example This screen shows editable text fields.

For more information about editable text fields, see the UI Guidelines.

Code sample: Creating an editable text field

import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.container.MainScreen;
import net.rim.device.api.ui.component.BasicEditField;

public class BasicEditFieldDemo extends UiApplication
{
    public static void main(String[] args) 
    {
        BasicEditFieldDemo theApp = new BasicEditFieldDemo();
        theApp.enterEventDispatcher();
    }
    
    public BasicEditFieldDemo()
    {
        pushScreen(new BasicEditFieldDemoScreen());
    }
}

class BasicEditFieldDemoScreen extends MainScreen
{
    public BasicEditFieldDemoScreen()
    {
        setTitle("Editable Text Field Demo");
        
        BasicEditField enterName = new BasicEditField("Your name: ", "");
        BasicEditField enterPhone = new BasicEditField("Work number: ", "", 50, BasicEditField.FILTER_PHONE);
        
        add(enterName);
        add(enterPhone);
    }
}
Next topic: Password field
Previous topic: Read-only text field

Was this information helpful? Send us your comments.