cell(HtmlPanel) is not resizable in kotlin UI DSL 2

Answered

When I use HtmlPanel on its own it is resizable. When I use inside `row` dsl builder with `cell` the resulting panel is not resizable. Is it supposed behavior? Or can I somehow make it resizable?

// WHEN RESIZABLE
override fun createCenterPanel(): JComponent? {
return object : HtmlPanel() {
init {
isVisible = true
update()
}
override fun getBody() = someHtml
}
}


// WHEN NOT RESIZABLE
override fun createCenterPanel(): JComponent? {
val htmlPanel = object : HtmlPanel() {
init {
isVisible = true
update()
}
override fun getBody() = someHtml
}
return panel {
row {
cell(htmlPanel)
}
}
}
0
8 comments

Hi,

Try to use Cell.resizableColumn():

override fun createCenterPanel(): JComponent? {
...
return panel {
row {
cell(htmlPanel).resizableColumn()
}
}
}
0

Hi, it does not help. The dialog is resizable only to the right, but not to the left:

0

But when using like this:

override fun createCenterPanel(): JComponent? {
val htmlPanel = object : HtmlPanel() {
init {
isVisible = true
update()
}
override fun getBody(): String {
return html
}
}
return htmlPanel
}
0

It works: 

 

0

I also tried this:

        return panel {
            row {
                cell(htmlPanel).resizableColumn()
            }.resizableRow()
        }
0

Please try with:

panel {
row {
cell(htmlPanel)
.horizontalAlign(HorizontalAlign.FILL)
.verticalAlign(VerticalAlign.FILL)
}.resizableRow()
}

 

0

I tried: the same behaviour, as in first gif

 

0

I looked a bit in the sources and if I am not mistaken, the dsl uses some grid layout that lays out cells or subgrids and it the grid itself does not support resizing the cells. So using dsl here apparently is not suitable. Correct me if I am wrong. 

0

Please sign in to leave a comment.