KetraTerm
API · DevelopmentAll versions

SwingScrollbarAdapter

Bridges a top-origin Swing scrollbar to the shared terminal viewport.

The scrollbar retains pixel-scale coordinates, allowing its thumb to move continuously during direct manipulation. Each thumb position maps to an integer top row, which is applied immediately with no easing lag. Terminal publications do not overwrite the host-owned thumb coordinate during a drag, and release is already row-aligned.

The scrollbar remains visible even when no history is retained so host layouts reserve its width before the first scrollback-producing command. Hiding it after session start would shrink the terminal component and can make PTY/core width synchronization lag by one cell.

Construct and use this adapter on the Swing Event Dispatch Thread (EDT). The host owns this adapter and must close it when its attachment ends. The scrollbar and scrolling destination remain host-owned.

Parameters

scrollbar

host-owned vertical scrollbar.

Constructors

Link copied to clipboard
constructor(scrollbar: JScrollBar)

Functions

Link copied to clipboard
fun attach(viewportScroller: SwingScrollbarScroller)

Attaches the terminal controlled by this adapter.

Link copied to clipboard
open override fun close()

Releases the scrolling destination and removes only this adapter's adjustment listener.

Link copied to clipboard
open override fun viewportChanged(historySize: Int, scrollbackOffset: Double, renderOffset: Int, visibleRows: Int, requestedRows: Int)

Reports the latest presentation viewport coordinates.

Link copied to clipboard

Reports the full viewport snapshot, including pixel scroll range.