Class TabPanel

java.lang.Object
All Implemented Interfaces:
HasAttachHandlers, HasBeforeSelectionHandlers<Integer>, HasSelectionHandlers<Integer>, HasHandlers, EventListener, HasAnimation, HasVisibility, HasWidgets, IndexedPanel, IndexedPanel.ForIsWidget, IsRenderable, IsWidget, SourcesTabEvents, TabListener, Iterable<Widget>, EventListener
Direct Known Subclasses:
DecoratedTabPanel

A panel that represents a tabbed set of pages, each of which contains another widget. Its child widgets are shown as the user selects the various tabs associated with them. The tabs can contain arbitrary HTML.

This widget will only work in quirks mode. If your application is in Standards Mode, use TabLayoutPanel instead.

Note that this widget is not a panel per se, but rather a Composite that aggregates a TabBar and a DeckPanel. It does, however, implement HasWidgets.

CSS Style Rules

  • .gwt-TabPanel { the tab panel itself }
  • .gwt-TabPanelBottom { the bottom section of the tab panel (the deck containing the widget) }

Example

public class TabPanelExample implements EntryPoint {

  public void onModuleLoad() {
    // Create a tab panel with three tabs, each of which displays a different
    // piece of text.
    TabPanel tp = new TabPanel();
    tp.add(new HTML("Foo"), "foo");
    tp.add(new HTML("Bar"), "bar");
    tp.add(new HTML("Baz"), "baz");

    // Show the 'bar' tab initially.
    tp.selectTab(1);

    // Add it to the root panel.
    RootPanel.get().add(tp);
  }
}

See Also: