ScrollPaneScope

sealed interface ScrollPaneScope

The receiver of a ScrollPane's content, through which a child declares the part of the pane it configures or the region it fills.

A pane builds its viewport and both scroll bars itself. Viewport, VerticalScrollbar and HorizontalScrollbar configure those parts, and the content of Viewport is the view it scrolls. The row header, the column header and the four corners are empty until a child fills them, so a child names one of them on its own modifier:

ScrollPane {
Viewport(unitIncrement = 16) { Column { Rows() } }
VerticalScrollbar(modifier = SwingModifier.background(surface))
Label(text = "Rows", modifier = SwingModifier.rowHeader())
Label(text = "*", modifier = SwingModifier.corner(JScrollPane.UPPER_TRAILING_CORNER))
}

A pane holds nothing besides these parts and regions, so a child that declares none of them is refused, naming the pane and the calls that would place it. Each part and each region is declared once: two Viewports, or two children naming the same region, are refused too. An if/else that selects one of two declarations of a part keeps the part and applies the selected one. The four corners are four regions, so two children in different corners are two children in their own regions. A child that goes away releases the region it held, and a part whose declaration goes away gets back the values its modifier replaced.

See also

Functions

Link copied to clipboard

Installs the child as the column header, shown in a viewport pinned to the top edge and scrolled horizontally in sync with the content.

Link copied to clipboard
abstract fun SwingModifier.corner(corner: String): SwingModifier

Installs the child in the corner slot, the square where two of the pane's edges meet.

Link copied to clipboard
@Composable
abstract fun HorizontalScrollbar(modifier: SwingModifier = SwingModifier)

Configures the pane's own horizontal scroll bar. The bar is shown as the pane's horizontalScrollbar policy says.

Link copied to clipboard

Installs the child as the row header, shown in a viewport pinned to the leading edge and scrolled vertically in sync with the content.

Link copied to clipboard
@Composable
abstract fun VerticalScrollbar(modifier: SwingModifier = SwingModifier)

Configures the pane's own vertical scroll bar. The bar is shown as the pane's verticalScrollbar policy says.

Link copied to clipboard
@Composable
abstract fun Viewport(modifier: SwingModifier = SwingModifier, unitIncrement: Int? = null, blockIncrement: Int? = null, content: @Composable () -> Unit)

Configures the pane's own viewport, and shows content as the view it scrolls.