Search code examples
javafxtornadofx

Tornadofx Custom Table Cell


how to insert a button or any other kind of component in javafx tableview cell using tornadofx ? I am in a situation where i have a column header "Action". I need to render several action buttons in the table view .


Solution

  • Use the cellFormat function and assign a container with the buttons to the graphic property of the cell:

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