mercredi 1 juillet 2020

mysql fetch to jtable column checkbox

How i can fetch data from MySQL to JTable and add JTable column number 3 checkbox This is my code

String sql = "select `id`,`CostCentersName`, case when `Status` = 1 then true else false end AS Status from costcenters limit 0,10 ";
    Clas.classtable obj = new Clas.classtable();
    DefaultTableModel dtm = obj.Query(sql);
    datatable.setModel(dtm);
    CheckBoxRenderer checkBoxRenderer = new CheckBoxRenderer();
    datatable.getColumnModel().getColumn(2).setCellRen  derer(checkBoxRenderer);

And i see this error

Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Boolean



Aucun commentaire:

Enregistrer un commentaire