如何在 TornadoFX 中隐藏 tableview 的 header?

How to hide the header of a tableview in TornadoFX?

是否有 tornadofx-way 来隐藏表视图的 header 行? 我该怎么做?

谢谢。 :-)

我试图在 tableview 中找到某种 header 属性,但有 none。我必须通过 css/style 来完成吗?

TornadoFX 没有特定的函数可以执行此操作,但您可以创建一个样式表,甚至可以在 TableView 定义中创建一个内联样式表来处理它:

stylesheet {
    Stylesheet.columnHeaderBackground {
        maxHeight = 0.px
        prefHeight = 0.px
        minHeight = 0.px
    }
}

写在外部类型安全样式表中,如下所示:

class Styles : Stylesheet() {
    companion object {
        val tableNoHeader by cssclass()
    }

    init {
        tableNoHeader {
            maxHeight = 0.px
            prefHeight = 0.px
            minHeight = 0.px
        }
    }
}

现在您只需将 Styles.tableNoHeader css class 添加到您的 TableView。

哦,记得将样式表添加到您的 App 构造函数:)