0

如何将用户名和密码字段放入文本框中?

usernameField = new EditField("USERNAME:", "");
passwordField = new PasswordEditField("PASSWORD:", "");
add(usernameField);
vm.add(new LabelField("\n"));
add(passwordField);
ButtonField buttonField_1 = new ButtonField( "Login",ButtonField.FIELD_HCENTER );
add( buttonField_1 );   
ButtonField buttonField_2 = new ButtonField( "Forgot Password",ButtonField.FIELD_HCENTER );
add( buttonField_2 );   
buttonField_1.setMargin(100, 10, 10, 10);
//popup1();
buttonField_1.setChangeListener( new FieldChangeListener() {
    public void fieldChanged( Field arg0, int arg1 ) {
        if (usernameField.getTextLength() == 0 || passwordField.getTextLength() == 0) {
            Dialog.alert("You must enter a username and password");
        } else {
            profile();
        }
    }
});

buttonField_2.setChangeListener( new FieldChangeListener() {
    public void fieldChanged( Field arg0, int arg1 ) {
        UiApplication.getUiApplication().pushScreen(new Forgot_Pwd());
    }
});
4

2 回答 2

2

http://keraisureshvblackberry.blogspot.in/2012/02/on-last-post-we-have-study-lablefiled.html

该博客帮助您创建用户名和密码文本框

如果您从归档中获取文本,则可以使用 usernameField.getText()passwordField.getText()

于 2012-04-27T12:37:53.257 回答
0

TextField - 在用户开始输入文本之前显示提示

你可以试试那个链接。它有助于制作盒子,但即使我一直在努力创造一个和你建议的一样的盒子。如果有人有更多的想法,将不胜感激。

于 2012-04-26T13:13:17.357 回答