A tab widget is a widget that organizes contents in tab panes.

A WTabWidget combines a horizontal WMenu with a WStackedWidget in a tab-like look. A tab widget will place the tab bar on top of the contents, and fit the contents below it. It is similar to a WNavigationBar but with fewer options like a title or multiple menus.

Example
source
  void Tab() {
    WContainerWidget container = new WContainerWidget();
    WTabWidget tabW = new WTabWidget((WContainerWidget) container);
    tabW.addTab(
        new WTextArea("This is the contents of the first tab."), "First", ContentLoading.Eager);
    tabW.addTab(
        new WTextArea(
            "The contents of the tabs are pre-loaded in the browser to ensure swift switching."),
        "Preload",
        ContentLoading.Eager);
    tabW.addTab(
            new WTextArea(
                "You could change any other style attribute of the tab widget by modifying the style class. The style class 'trhead' is applied to this tab."),
            "Style",
            ContentLoading.Eager)
        .setStyleClass("trhead");
    WMenuItem tab =
        tabW.addTab(
            new WTextArea("You can close this tab by clicking on the close icon."), "Close");
    tab.setCloseable(true);
    tabW.setStyleClass("tabwidget");
  }

The tab widget is styled by the current CSS theme. The look (of the header) can be overridden using the JWt-tabs CSS class and addition to selectors like ul, li and span.

Top