如何将简单表单​​字段添加到BlackBerry应用程序?

时间:2011-02-21 12:47:28

标签: java forms blackberry

假设我有一个继承自MainScreen的类,我如何为用户输入设置几个表单字段?

1 个答案:

答案 0 :(得分:1)

    // Inside the constructor

    LabelField label1 = new LabelField("Hello World Demo" , LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH);

    EditField firstNameEditField = new EditField(EditField.NO_NEWLINE | EditField.NON_SPELLCHECKABLE | EditField.NO_COMPLEX_INPUT);

    EditField lastNameEditField = new EditField(EditField.NO_NEWLINE | EditField.NON_SPELLCHECKABLE | EditField.NO_COMPLEX_INPUT);

    ButtonField submitButton = new ButtonField("Submit")
            {
                protected boolean navigationClick(int status, int time) 
                {
                    onSubmit();

                    return true;
                }
            };

        this.add(label1);
        this.add(firstNameEditField);
        this.add(lastNameEditField);
        this.add(submitButton);