How to add simple form fields to a BlackBerry appl

2019-09-05 14:13发布

Assuming I have a class inherited from MainScreen, how do I put up a couple of form fields for user input?

1条回答
ら.Afraid
2楼-- · 2019-09-05 14:52
    // 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);
查看更多
登录 后发表回答