Bonjour , je cherche à colorer une quelque ligne de mon jtable avec une condition ,les lignes dont la valeur de "Quantité_disponible" est négative .
voici mon code mais malheureusement ca marche pas

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
void colorer(){    
try {
 
 
            Connection conn;
                Class.forName("com.mysql.jdbc.Driver");
                conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/stage","root","admin");
 
                Statement pst=conn.createStatement();
 
                ResultSet rs=pst.executeQuery("SELECT * from article where Qte_dispo<=0 ");
 
           while(rs.next()){
String add4=rs.getString("Qte_dispo");
int qte=Integer.parseInt(add4);
 
           if(qte<0) {
                  table_article.setBackground(Color.red);
               }}
            } catch (Exception ev)
            {
                System.out.println(ev);
            }}