开发者

in j2me lwuit,with theme the combobox drop down and other component will hide

without theme combobox drop down correctly and other component show correctly. when using theme combobox drop down but other component will hide.

    Form f;
    TextField t4;
    ComboBox com1, com2, com3;
    Container c1, c2, c3, c4;
    Button add;
    Command back, save;
    Resources resources;

    public void startApp() {
        Display.init(this);
        try {
            resources = Resources.open("/nn.res");
            UIManager.getInstance().setThemeProps(resources.getTheme(resources.getThemeResourceNames()[0]));
        } catch (Exception e) {
        }
        f = new Form("Form");
        f.setLayout(new BoxLayout(BoxLayout.Y_AXIS));

        com1 = new ComboBox(new String[]{"123", "234", "345", "456"});
        com2 = new ComboBox(new String[]{"123", "234", "345", "456"});
        com3 = new ComboBox(new String[]{"123", "234", "345", "456"});

        t4 = new TextField(5);
        back = new Command("Back", 1);
        save = new Command("Save", 2);

        add = new Butt开发者_StackOverflow社区on("kjkk");

        c1 = new Container(new FlowLayout());
        c2 = new Container(new FlowLayout());
        c3 = new Container(new FlowLayout());
        c4 = new Container(new BorderLayout());



        c1.addComponent(new Label("Project Name:"));
        c1.addComponent(com3);

        c2.addComponent(new Label("Description:"));
        c2.addComponent(com1);

        c3.addComponent(new Label("Sub Category:"));
        c3.addComponent(com2);

        c4.addComponent(BorderLayout.WEST, new Label("Qty:"));
        c4.addComponent(BorderLayout.CENTER, t4);
        c4.addComponent(BorderLayout.EAST, add);

        f.addComponent(c1);
        f.addComponent(c2);
        f.addComponent(c3);
        f.addComponent(c4);

        f.addCommand(back);
        f.addCommand(save);

        f.show();


    }

    public void pauseApp() {
    }

    public void destroyApp(boolean unconditional) {
    }
}


Its never happen when you are using with or without Resource Edit file. Just add the Selected and Unselected style for components. Look at this article for building themes using Resource Edit. Also Lot of video's available for building a theme with new Resource Edit.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜