在j2me 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) {
}
}
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当您使用或不使用资源编辑文件时,它永远不会发生。只需为组件添加“选定”和“未选定”样式即可。查看这篇文章,了解使用资源编辑构建主题。还有很多视频可供使用新资源构建主题编辑。
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.