How to add simple form fields to a BlackBerry application?

自古美人都是妖i 提交于 2019-12-12 05:58:31

问题


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


回答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);


来源:https://stackoverflow.com/questions/5066146/how-to-add-simple-form-fields-to-a-blackberry-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!