如何在vaadin中使用标题复选框选中所有复选框

我是vVadin的新手。我创建了一个具有两个列的网格项目,但是我想添加一个Textfield列和一个复选框列,并在单击header复选框时选中所有复选框。

List<Person> people = Arrays.asList(
            new Person("Nicolaus Copernicus", 15),
            new Person("Galileo Galilei", 15),
            new Person("Johannes Kepler", 15));
     TextField txt =new TextField();
      CheckBox chk=new CheckBox();
        // Create a grid bound to the list
        Grid<Person> grid = new Grid<>();
        grid.setItems(people);
        grid.addColumn(Person::getName).setCaption("Name");
        grid.addColumn(Person::getAge).setCaption("Year of birth");
       grid.addColumn(Person-> new TextField());


        layout.addComponents(grid);


    setParent(layout);

有没有人建议me.how添加这两列

转载请注明出处:http://www.jlgayy.com/article/20230526/2003203.html