``` class MainView : View() { val persons: Obs...
# tornadofx
a
Copy code
class MainView : View() {
    val persons: ObservableList<Person> = FXCollections.observableArrayList<Person>()
    override val root = vbox {
        textfield {
            action {
                persons.add(Person(text, false))
                clear()
            }
        }
        listview(persons) {
            cellFormat {
                graphic = cache {
                    form {
                        fieldset {
                            hbox {
                                checkbox {
                                    if (it.selection) {
                                        this.isSelected = true
                                    }
                                    action {
                                        persons.get(persons.indexOf(it)).selection = !it.selection
                                    }
                                }
                                label(it.name) {
                                    style {
                                        fontSize = 12.px
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}

class Person(val name: String, var selection: Boolean)