在j2me lwuit中,使用主题组合框下拉,其他组件将隐藏

发布于 2024-12-02 17:04:22 字数 1848 浏览 1 评论 0原文

没有主题组合框正确下拉并且其他组件正确显示。使用主题组合框下拉时,但其他组件将隐藏。

    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 Button("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) {
    }
}

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 Button("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) {
    }
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

九八野马 2024-12-09 17:04:22

当您使用或不使用资源编辑文件时,它永远不会发生。只需为组件添加“选定”和“未选定”样式即可。查看这篇文章,了解使用资源编辑构建主题。还有很多视频可供使用新资源构建主题编辑。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文