There's not a lot of use for a TabBar other than in a TabPanel. Unless you need a alternative to a horizontal panel of RadioButtons.
TabBar widget = new TabBar();
public void buildPage()
{
widget.addStyleName("demo-TabBar");
widget.addTab("First");
widget.addTab("Second");
widget.addTab("Third");
widget.addTab("Fourth");
widget.addTab("Fifth");
widget.selectTab(0);
widget.addTabListener(this);
SingleCellPanel panel = new SingleCellPanel();
panel.addStyleName("demo-panel-padded");
panel.add(widget);
RootPanel.get("demo").add(panel);
}
public boolean onBeforeTabSelected(
SourcesTabEvents sender, int tabIndex)
{
return (Window.confirm("You really want to leave '"
+ widget.getTabHTML(widget.getSelectedTab())
+ "' and go to '"
+ widget.getTabHTML(tabIndex)
+ "'?"));
}
public void onTabSelected(
SourcesTabEvents sender, int tabIndex)
{
}