Skip to content

TabControl

Tabbed navigation container with a scrollable header bar and switched content area.

Overview

Tabbed navigation container with a scrollable header bar and switched content area. Provides extensive layout configuration and interaction capabilities.

Basic Usage

TabControl tabs = new TabControl();
tabs.addTab("Editor", new PanelWidget());
tabs.addTab("Console", new PanelWidget());
tabs.selectTab(0);
  • PageView: Retained page container that keeps exactly one page visible at a time.

API

TabControl()

Constructs a new TabControl instance.

TabControl::addTab(RichText, Widget)

Appends a new tab with RichText title and content widget.

Parameter Type Description
title RichText The title text.
content Widget The content widget.

Returns TabControl: This instance for chaining..

TabControl::addTab(String, Widget)

Appends a new tab with plain text title and content widget.

Parameter Type Description
title String The title text.
content Widget The content widget.

Returns TabControl: This instance for chaining..

TabControl::clearTabs()

Removes all tabs and their content.

Returns TabControl: This instance for chaining..

TabControl::contentHost()

Returns the stack container holding tab page contents.

Returns StackPanel: The container hosting content views..

TabControl::insertTab(int, RichText, Widget)

Inserts a new tab with RichText title at the specified index.

Parameter Type Description
index int The index position.
title RichText The title text.
content Widget The content widget.

Returns TabControl: This instance for chaining..

TabControl::insertTab(int, String, Widget)

Inserts a new tab with plain text title at the specified index.

Parameter Type Description
index int The index position.
title String The title text.
content Widget The content widget.

Returns TabControl: This instance for chaining..

TabControl::onSelectionChanged(EventListener)

Registers a listener invoked when the selected tab index changes.

Parameter Type Description
listener EventListener The event listener callback.

Returns EventSubscription: The event subscription handle..

TabControl::removeTab(int)

Removes the tab at the specified index.

Parameter Type Description
index int The index position.

Returns TabControl: This instance for chaining..

TabControl::selectRelative(int)

Shifts tab selection by the relative delta offset.

Parameter Type Description
delta int The relative offset delta.

Returns TabControl: This instance for chaining..

TabControl::selectTab(int)

Selects the tab at the specified index, firing a selection change event.

Parameter Type Description
index int The index position.

Returns TabControl: This instance for chaining..

TabControl::selectedContent()

Returns the content widget of the selected tab, or null if none.

Returns Widget: The content of the selected tab or panel..

TabControl::selectedIndex()

Returns the 0-based index of the currently selected tab, or -1 if none.

Returns int: The selected index, or -1 if none..

TabControl::selectedTab()

Returns the currently selected Tab descriptor, or null if none.

Returns Tab: The selected Tab descriptor, or null..

TabControl::silentSelectTab(int)

Silently selects the tab at the given index without emitting events.

Parameter Type Description
index int The index position.

Returns TabControl: This instance for chaining..

TabControl::tabButton(int)

Returns the toggle button corresponding to the tab at the given index.

Parameter Type Description
index int The index position.

Returns ToggleButton: The ToggleButton for the specified tab..

TabControl::tabCount()

Returns the total number of tabs.

Returns int: The total number of tabs..

TabControl::tabHeader()

Returns the header container holding tab toggle buttons.

Returns HBox: The tab header container..

TabControl::tabHeaderScroll()

Returns the scroll view wrapping the tab header.

Returns ScrollView: The scroll container wrapping the tab header..

TabControl::tabs()

Returns an unmodifiable list of tab descriptors.

Returns List: An unmodifiable list of tab descriptors..