Password field

Use a password field when BlackBerry® device users are required to type a password. You can apply filters to restrict the characters that users can type in the field. By default, the password field supports all characters.

Class PasswordEditField
Supported since BlackBerry® Java® SDK 4.2.1
Example This screen shows a password field.

For more information about password fields, see the UI Guidelines.

Code sample: Creating a password field

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

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

class PasswordEditFieldDemoScreen extends MainScreen
    public PasswordEditFieldDemoScreen()
        setTitle("Password Field Demo");
        BasicEditField enterUsername = new BasicEditField("Username: ", "");
        PasswordEditField enterPIN = new PasswordEditField("PIN: ", "", 4, PasswordEditField.FILTER_NUMERIC);
Next topic: Email address field
Previous topic: Editable text field

Was this information helpful? Send us your comments.