Package-level declarations

Types

Link copied to clipboard

What a modifier element puts back when its declaration leaves, declared through SwingModifier.NodeElement.restores.

Link copied to clipboard
@Stable
interface SwingModifier

An ordered, immutable collection of Elements applied to a Swing component - the Swing analogue of androidx.compose.ui.Modifier. Most are a NodeElement, which carries the node that writes onto the component; the rest declare something the node holder reads itself, such as where the component is attached in its parent.

Link copied to clipboard

The diff state for one node's modifier: the elements applied last, and the buffers the modifier being applied is partitioned into.

Functions

Link copied to clipboard
fun SwingModifier.key(vararg keys: Any?): SwingModifier

Ties this modifier's application to keys. While they stand the modifier is diffed as usual; a key that does not compare equal to the one applied last takes the whole modifier apart and applies it again from scratch.

Link copied to clipboard
inline fun <T : Component, V> SwingModifier.property(name: String, value: V, noinline read: (component: T) -> V, noinline write: (component: T, value: V) -> Unit, restores: RestorePolicy = RestorePolicy.EverythingWritten): SwingModifier

Declares one Swing property on the component. The property is read as the declaration arrives and written back when the declaration leaves, so a widget that outlives it carries what it did before. Fold the element in only while a value is declared:

fun <T : Component, V> SwingModifier.property(targetType: KClass<T>, name: String, value: V, read: (component: T) -> V, write: (component: T, value: V) -> Unit, restores: RestorePolicy = RestorePolicy.EverythingWritten): SwingModifier

Declares one Swing property on the component, naming the component type as a value.