PDA

View Full Version : TabItem not working with panel



lightblade
25 Oct 2008, 10:23 PM
I tried adding another panel to a TabItem, but it just doesn't show anything. It seem to work if I add Label directly.

After compiling it, I notice this problem only present in IE, and not Firefox.



public void onModuleLoad() {
TabPanel panel = new TabPanel();
panel.setTabPosition(TabPosition.BOTTOM);

TabItem tab1 = new TabItem();
tab1.setText("tab1");
ContentPanel simp = new ContentPanel();
simp.setHeight(100);
simp.add(new Label("tab1"));
tab1.add(simp);

TabItem tab2 = new TabItem();
tab2.setText("tab2");
ContentPanel simp2 = new ContentPanel();
simp2.setHeight(100);
simp2.add(new Label("tab2"));
tab2.add(simp2);

panel.add(tab1);
panel.add(tab2);

RootPanel.get().add(panel);
}

gslender
25 Oct 2008, 11:57 PM
you need to give the tabpanel a size...


panel.setSize(600,400);

or add to a viewport with a fitlayout()

lightblade
26 Oct 2008, 12:09 AM
Thanks!