Salut,
Je suis en train de developper une application java avec NetBeans et la bibliothèque Swing.

j'ai besoin d'une jTable qui soit rempli à partir de la base de données
avec un colonne de type jcheckBox.
Dans les proprietés de mon jTable la 6éme colonne (de type jChekBox) Model type j'ai choisi Boolean

Voici mon code

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
 public class MyTableContactModel extends AbstractTableModel{
 
 
        private int colnum=6;
        private int rownum;
 
        private  ArrayList<String[]> ResultSets;
        private String[] columnNames ={
           &quot;codecontact&quot;,&quot;nom&quot;,&quot;prenom&quot;,&quot;ville&quot;,&quot;pays&quot;    };
 
       public MyTableContactModel(ResultSet rs) {
 
      ResultSets=new ArrayList<String[]>();  
 
      try{
        while(rs.next()){
 
              String[] row={
                rs.getString(&quot;codecontact&quot;), rs.getString(&quot;prenom&quot;),rs.getString(&quot;nom&quot;),rs.getString(&quot;ville&quot;),rs.getString(&quot;pays&quot;)      
              };
 
      ResultSets.add(row); 
      }   
      }
      catch(Exception e){
          System.out.println(&quot;Exception in MyTableContactModel&quot;);
            }
 
    }
 
 
        public Class getColumnClass(int c) {
        return getValueAt(0, c).getClass();
    }   
 
        public int getColumnCount()
        {
            return columnNames.length;
        }
 
        public String getColumnName(int col)
        {
            return columnNames[col];
        }
        public Object getValueAt(int rowindex, int columnindex)
        {
            String[] row=ResultSets.get(rowindex);
       return row[columnindex];
        }
 
        public boolean isCellEditable(int row, int col)
        {
            if (col < 2)
            {
                return false;
            }
            else
            {
                return true;
            }
        }
        public void setValueAt(Object value, int row, int col)
        {
//            data[row][col] = value;
            fireTableCellUpdated(row, col);
        }
 
    @Override
    public int getRowCount() {
       return ResultSets.size();
    }
    }
et dans le CustomizeCode j'ai ecris

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
 private ResultSet getResultFromContactClient() {
       ResultSet rs=null;
        try{
            rs= (ResultSet) stmt.executeQuery(&quot;select   codecontact, prenom, nom, ville, pays   from  contact &quot;);
        }
        catch(SQLException e){}
         return rs;
       }
ResultSet rs=getResultFromContactClient();
jTableContactClient.setModel(new MyTableContactModel(rs));
Malheureusement, dans l'affichage j'obtient un jtable avec seulement 5 colonnes(pas de ChekBox) remplis de la base de données

Si je supprime le code dans Customizecode
j'obtient un jTable vide mais avec un jCheckBox.
Où est le problème???
Mercii d'avance.