All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jvmTest.io.mths.swing.flow.util.WithAttached.kt Maven / Gradle / Ivy

The newest version!
package io.mths.swing.flow.util

import javax.swing.JComponent
import javax.swing.JPanel

/**
 * Executes [actions] with a receiver attached to a [JPanel],
 * to ensure the flow bindings are active.
 */
internal inline fun  withAttached(
    component: Type,
    actions: Type.() -> Unit
) {
    val parent = JPanel().apply {
        add(component)
    }

    component.actions()
    parent.removeAll()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy