0
我已經編寫了一個程序,用於讀取數據庫中的數據,最後一列是布爾值,0表示false,1表示true,但我想將該列顯示爲複選框。我現在會貼上我的代碼: 私人無效update_table(){將布爾jtable列轉換爲複選框
String sql = "select dailies.id as 'م', customers.name as' العميل',ddate as' التاريخ' ,cars.name as' السيارة',material.name as' المادة',quantity as'عدد',dailytypes.name as' الوحدة',unitprice as' سعر الوحدة',discount as' الخصم',(unitprice*quantity - discount) as' الإجمالي',notes as' ملاحظات', paid as'تم السداد' from dailies,customers,cars,material,dailytypes where ddate=? and dailies.customer = customers.id and dailies.car = cars.id and dailies.material = material.id and dailies.type = dailytypes.id order by ddate";
try{
pst = conn.prepareStatement(sql);
//JOptionPane.showMessageDialog(null, currentdate());
pst.setString(1, currentdate());
rs = pst.executeQuery();
tbldailies.setModel(DbUtils.resultSetToTableModel(rs));
//tbldailies.addColumn();
}catch (Exception ex){
JOptionPane.showMessageDialog(null, ex);
} finally{
try{
rs.close();
rs1.close();
pst.close();
}
catch(Exception e){
e.printStackTrace();
}
}
}
你已經試過了什麼?請閱讀以下內容:http://meta.stackexchange.com/questions/156810/stack-overflow-question-checklist –