【问题标题】:How do I get the username and password field into a Blackberry Text Box?如何将用户名和密码字段放入黑莓文本框?
【发布时间】:2012-04-26 06:39:07
【问题描述】:

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

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

【问题讨论】:

  • 解释你的问题。使用usernameField.getText()passwordField.getText()EditFieldPasswordEditField 检索文本。 into a text box 是什么意思?
  • 如果您从某个数据库或其他类中获取数据,您可以在 EditField 或 PasswordField 上使用 settext() 方法,这就是您想要的,否则解释我们知道的问题,您实际上想要什么。跨度>
  • 我想做一个圆形矩形并将这些字段放入其中
  • 就像在黑色背景中一样,中间会有一个白色矩形,里面有这两个字段

标签: java blackberry


【解决方案1】:

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

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

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

【讨论】:

    【解决方案2】:

    TextField - show hint before user starts typing text

    您可以尝试该链接。它有助于制作盒子,但即使我一直在努力尝试创建一个与您建议的相同的盒子。如果有人有更多想法,将不胜感激。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-04-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多