是否可以在黑莓应用程序中动态添加选项卡?
我发现这段代码适用于 java,但是当我尝试在 BB JDE 中为黑莓做时,它没有给出任何结果。
final TabSheet tabSheet = new TabSheet();
Button button = new Button("Add the tab");
button.addListener(
new Button.ClickListener(){
public void buttonClick(ClickEvent event) {
VerticalLayout content = new VerticalLayout();
content.addComponent(new Label("This is the tab content."));
Tab tab = tabSheet.addTab(content, "The new Tab", null);
}
}
);
我以这种方式在黑莓中实现
final TabSheet tabSheet = new TabSheet();
ButtonField button = new ButtonField("Add the tab");
button.setChangeListener(
new FieldChangeListener()
{
public void fieldChanged(Field field,int context)
{
VerticalFieldManager content = new VerticalFieldManager();
content.addComponent(new LabelField("This is the tab content."));
Tab tab = tabSheet.addTab(content, "The new Tab", null);
}
}
);
使用“tabsheet”标识符有问题。他们在黑莓中的替代方式是什么?
更新:
final PaneManagerModel tabsheet = new PaneManagerModel();
ButtonField button = new ButtonField("Add the tab");
button.setChangeListener(
new FieldChangeListener()
{
public void fieldChanged(Field field,int context)
{
VerticalFieldManager content = new VerticalFieldManager();
content.add(new LabelField("This is the tab content."));
Pane panenew = new Pane(New,3);//Are the pane parameters right?
model.addPane(content, "The new Tab", null);//Can model be applied to this type?
}
}
);