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

时间:2011-09-05 06:48:02

标签: java java-me lwuit

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

    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) {
    }
}

2 个答案:

答案 0 :(得分:1)

当您使用或不使用资源编辑文件时,它永远不会发生。只需为组件添加Selected和Unselected样式即可。看看这篇文章的building themes using Resource Edit.还有很多视频可用于building a theme with new Resource Edit.

答案 1 :(得分:0)

此链接http://bit.ly/vzys4W提供了有关如何为lwuit设置组合框样式的一些信息。我希望它有所帮助。