4

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?

3
  • What DSL is this? Are you creating your own DSL? Commented Dec 4, 2024 at 16:40
  • plugins.jetbrains.com/docs/intellij/… Commented Dec 4, 2024 at 17:04
  • Oh I didn't know that's a thing until now. I learned something new. Commented Dec 4, 2024 at 17:12

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.