[B]onjour, je voudrai losque je selectionne une cellule qu'elle change de couleur de fond, mais ca me change toute la ligne.
comment ca se fait?
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 public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { Component cell = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); if(column != 0){ if(isSelected){ if (table.getValueAt(row,column).toString().compareTo("-1") != 0){ cell.setBackground(Color.CYAN); cell.setForeground(Color.PINK); } } return cell; }
Partager