Label

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

Class LabelField
Supported since BlackBerry® Java® SDK 4.0
Example This screen shows label fields.

For more information about labels, see the UI Guidelines.

Code sample: Creating a label

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();
        theApp.enterEventDispatcher();
    }
    
    public LabelFieldDemo()
    {
        pushScreen(new LabelFieldDemoScreen());
    }
}

class LabelFieldDemoScreen extends MainScreen
{
    public LabelFieldDemoScreen()
    {
        LabelField title = new LabelField("Label Field Demo", LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH);
        setTitle(title);
        
        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);

        add(labelField1);
        add(labelField2);
        add(labelField3);
    }
}
Previous topic: Text fields

Was this information helpful? Send us your comments.