Checkbox header of Grid component


I created a grid component with multi selection, then the row header shows in the first column a checkbox.

I would like to know how to control this checkbox by using Java code to select or deselect like when I click on the checkbox.