Salut tout le monde,

Voici mon probleme :

J'ai un JTable que je remplis avec un tableau d'objets mais je voudrais que certaines de ces cases affichent le contenu en gras et en rouge. donc j'ai pensé mettre dans la case de mon tableau un JLabel contenant mon texte.
Mais ca ne marche pas. Je vous mets 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
 
try{
        for(int i=0;i<listCom.size(); i++)
        {
 
 
                for(int j=0;j<7;j++)
                {
                    tab[x][j]=((Object[])(listCom.get(i)))[j];
 
                }
                tab[x][6]="";
                         tab[x][7]=""+(Double.parseDouble((String)((Object[])(listCom.get(i)))[3]))*(Double.parseDouble((String)((Object[])(listCom.get(i)))[4]));
                total=total+Double.parseDouble((String)tab[x][7]);
                if(i<listCom.size()-1)
                {
                        if(!((Object[])(listCom.get(i)))[0].equals(((Object[])(listCom.get(i+1)))[0]))
                    {
                        x++;
                        tab[x][6]=((Object[])(listCom.get(i)))[6];
                        double tot=total-Double.parseDouble((String)tab[x][6]);
                        JLabel lab = new JLabel();
                        lab.setText(f.format(tot));
                        lab.setForeground(Color.RED);
                        lab.setFont( new Font("Tahoma", Font.BOLD, 14));
                        tab[x][7]=lab;
                        total=0;
                    }
                    x++;
                }
        }
        }catch(Exception e)
        {            
            System.out.println("error : "+e);
        }
 
        String [] title={"NumCommande", "Produits","Conditionnement","Nombre","Prix","TVA","Remise","Total"};
        jTable1 = new JTable(tab, title);
        this.centrerTable(jTable1); 
        jTable1.setSize(800,600);
        JScrollPane scroll = new JScrollPane(jTable1);
        jPanel1.add(scroll);
Merci de votre aide