Would you like to tell us how we are doing?

You bet No thanks

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: label

Use a label to identify a UI component for a BlackBerry device user.



Supported since

BlackBerry Java SDK 4.0

More information

For more information about labels, see the UI Guidelines.


This screen shows label fields.

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

public class LabelFieldDemo extends UiApplication
    public static void main(String[] args) 
        LabelFieldDemo theApp = new LabelFieldDemo();
    public LabelFieldDemo()
        pushScreen(new LabelFieldDemoScreen());

class LabelFieldDemoScreen extends MainScreen
    public LabelFieldDemoScreen()
        LabelField title = 
            new LabelField("Label Field Demo", 
                            LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH);
        LabelField labelField1 = 
            new LabelField("Right-aligned label field", LabelField.FIELD_RIGHT);
        LabelField labelField2 = 
            new LabelField("Centered label field", 
                            LabelField.FIELD_HCENTER | LabelField.FOCUSABLE);
        LabelField labelField3 = 
            new LabelField("Left-aligned label field", LabelField.FIELD_LEFT);