textField variable not updating


I'm trying to implement a tool window with a couple of text fields, but the variables bound to the fields are not updating after I type something.


class RegexTesterToolWindowFactory : ToolWindowFactory {
override fun createToolWindowContent(project: Project, toolWindow: ToolWindow) {
val regexTesterToolWindow = RegexTesterToolWindow(toolWindow)
val contentFactory = ContentFactory.SERVICE.getInstance()
val content = contentFactory.createContent(regexTesterToolWindow.content, "", false)


private val LOG = logger<RegexTesterToolWindow>()

class RegexTesterToolWindow(toolWindow: ToolWindow) {
private var regex: String = ".*"
private var testText: String = ""
var content: JPanel

init {
content = panel {
row("Regex:") {
row {
button("Run") {
val pattern = java.util.regex.Pattern.compile(regex)
val matcher = pattern.matcher(testText)


regex is always ".*" no matter what I type in the text field. What am I missing?

Comment actions Permalink

Hi Rodrigo,

Kotlin UI DSL is intended to create forms and the binding happens on the form apply action. See:


You may want to use graph property which should update property on text field change:

private val regexProperty = PropertyGraph().graphProperty(::regex)


Comment actions Permalink

Hi Karol. That worked, thanks! Is this PropertyGraph documented somewhere? I couldn't find anything.

On the other hand, I read in the documentation that Kotlin UI DSL is the recommended way to build UIs (https://plugins.jetbrains.com/docs/intellij/user-interface-components.html), it isn't? what should I be using when I'm not building a form, but rather displaying information? 

Comment actions Permalink

Hi Rodrigo,

The property graph is mentioned in: https://plugins.jetbrains.com/docs/intellij/kotlin-ui-dsl-version-2.html#cellgraphproperty

This is about Kotlin UI DSL 2, but most of the features apply to both versions.

Regarding the UI DSL intention, we will clarify it soon.

We've updated the docs, so it should be clear now that Kotlin UI DSL is intended to create UI forms with input elements bound to some state objects.


Please sign in to leave a comment.