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
| public Component prepareRenderer(TableCellRenderer renderer, int row, int col) {
Component c2 = super.prepareRenderer(renderer, row, col);
String value = (String) getValueAt(row, 9);
String value2= (String) getValueAt(row, 4);
try {
if (ControleurPrincipal.choixLot(null).equals(value2)) {
c2.setForeground(Color.ORANGE);
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
} //colorie une ligne sur 2
Color[] colors = {new Color(224, 255, 255),new Color(255, 255, 240)};
Color color = getBackground();
int i;
if ( !isCellSelected(row, col)) {
color = colors[i=row % colors.length];
}
c2.setBackground(color);
//colorie les ligne celon le type du lot
if ("NORMAL HOLD - OOC".equals(value)) {
c2.setForeground(Color.ORANGE);
} else if ("NORMAL".equals(value)) {
c2.setForeground(Color.BLACK);
}else if ("NORMAL HOLD - OTHER".equals(value)){
c2.setForeground(Color.BLACK);
}else if (value.startsWith("DWR HOLD")){
c2.setForeground(Color.BLUE);
}
else {
c2.setForeground(Color.BLACK);
}
return c2;
} |
Partager