Sorry about the red box, but we really need you to update your browser. Read this excellent article if you're wondering why we are no longer supporting this browser version. Go to Browse Happy for browser suggestions and how to update.

Text field: editable 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

More information

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

Example

This screen shows editable text fields.

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);
    }
}