tab

abstract fun SwingModifier.tab(title: @Nls String, icon: Icon? = null, tooltip: @Nls String? = null, enabled: Boolean = true, mnemonic: Int = NO_MNEMONIC, displayedMnemonicIndex: Int? = null, background: Color? = null, foreground: Color? = null, header: @Composable () -> Unit? = null): SwingModifier

Makes the child the body of a tab titled title, at the position it is emitted in.

A header takes over what the tab strip renders for this tab. title and icon keep their meaning either way: they name the tab for accessibility and remain the values recomposition writes, so a tab that renders only a header is still named.

mnemonic selects the tab from the keyboard together with the look and feel's mouseless modifier, and the tab underlines the first character of title that key names. displayedMnemonicIndex takes that choice over where another character is to carry the underline; give each tab of one pane a mnemonic of its own, since the pane picks among tabs sharing one arbitrarily.

The tab keeps what its body remembers, and the components that body is realized as, for as long as the child holding this declaration keeps its composition identity - which is the position it is emitted in unless androidx.compose.runtime.key gives it one of its own. A child emitted ahead of an unkeyed body therefore hands it the tab already standing in that position.

Return

this chain with the tab declared on it.

Parameters

title

the tab's title

icon

the tab's icon, or null for none

tooltip

the tab's tooltip, or null for none

enabled

whether the tab can be selected

mnemonic

the key code selecting this tab, as a java.awt.event.KeyEvent VK_ constant, or -1 for none

displayedMnemonicIndex

the index into title of the character the tab underlines, or null to underline the one mnemonic names; -1, or an index title has since outgrown, underlines none

background

the color the tab itself is drawn in, or null for the pane's own

foreground

the color the tab's title is drawn in, or null for the pane's own

header

the composable rendered in the tab strip in place of title and icon, or null to let the tab strip render them itself

See also