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?
-
What DSL is this? Are you creating your own DSL?Sweeper– Sweeper2024年12月04日 16:40:19 +00:00Commented Dec 4, 2024 at 16:40
-
plugins.jetbrains.com/docs/intellij/…varan– varan2024年12月04日 17:04:57 +00:00Commented Dec 4, 2024 at 17:04
-
Oh I didn't know that's a thing until now. I learned something new.Sweeper– Sweeper2024年12月04日 17:12:20 +00:00Commented Dec 4, 2024 at 17:12
1 Answer 1
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.
Comments
Explore related questions
See similar questions with these tags.