How can I change the status of a checkbox in java? [closed]

-2

I have a delete a whole checkbox that when pressed it selects all the records and when I click it, it deletes them but after deleting them the checkbox stays with the brand and I want to remove it but I do not know how to put the checkbox to its original state

My code is as follows:

public void leeRifIdentif() {
    String RIF;
    int cont=0;
        TableModel model = datalistado.getModel();
            for(int i = 0; i < model.getRowCount(); i++){ 
                if((Boolean)model.getValueAt(i, 0) == true){
                    RIF=((String)model.getValueAt(i, 1));   
                    cont++;
                    try{
                         ps =cn.prepareStatement("DELETE FROM cliente WHERE rif=?");
                         String rif = String.valueOf(RIF);
                         ps.setString(1,rif);
                         ps.executeUpdate();
                         MostrarDatos(false);
                         VaciarCampos();                              
                    }catch(Exception e){
                         System.out.println(e.getMessage());
                    }
                }     
       }
}
    
asked by Efrainrodc 22.12.2016 в 23:41
source

1 answer

0

Assuming you are using JCheckBox , you should use checkbox.setSelected(false); .

If you are using java.awt.Checkbox , you should use checkbox.setState(false);

The object is checkbox.

If it's none of these, search link . Maybe there you will find the method you are looking for.

    
answered by 23.12.2016 / 05:25
source