Tornadofx 自定义 Table 单元格

Tornadofx Custom Table Cell

如何使用 tornadofx 在 javafx tableview 单元格中插入按钮或任何其他类型的组件? 我的情况是我有一列 header "Action"。我需要在 table 视图中呈现几个操作按钮。

使用 cellFormat 函数并将带有按钮的容器分配给单元格的 graphic 属性:

column("Name", SomeObject::someproperty).cellFormat {
    graphic = hbox(spacing = 5) {
        button("Action 1").action { doSomething() }
        button("Action 2").action { doSomethingElse() }
    }
}