-
-
Save nimatrueway/1a9cdeb0023f261cbea35730fc8bab03 to your computer and use it in GitHub Desktop.
MigPane extension methods for TornadoFX
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javafx.event.EventTarget | |
import javafx.scene.Node | |
import org.tbee.javafx.scene.layout.fxml.MigPane | |
import tornadofx.attachTo | |
fun EventTarget.migPane(op: MigPane.() -> Unit = {}): MigPane { | |
return MigPane().attachTo(this, op) | |
} | |
var Node.cc: String | |
get() = throw IllegalAccessError("No getter") | |
set(value) { | |
val migLayout = this.parent | |
if (migLayout is MigPane) | |
migLayout.setComponentConstraints(this, value) | |
else | |
throw IllegalStateException("$this is not the immediate child of a MigPane!") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Examples: