The question is about plugin development using Kotlin UI DSL (https://plugins.jetbrains.com/docs/intellij/kotlin-ui-dsl-version-2.html)
For example, I have panel
panel {
list.forEach { item ->
row {
label(item)
}
}
}
And I want to add a button that adds an item to list. How to do that? How add row to the panel? Recreate it from scratch?
Almost all UI forms in Kotlin UI DSL Version 2 are static. For a dynamic content, placeholders
must be used. Placeholders allow you replacing components at runtime after content is presented. Placeholder can be used as a reserved cell in the layout. You're capable of creating it using the Row.placeholder()
method and fill it with content later using the component's property (or replace it with null
, if desired).
Also, you might find some custom Swing components interesting.