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 73 74
| /*
* NewClass.java
*
* Created on 24. octobre 2006, 14:08
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package dmind.ihm;
import dmind.gestion_questionnaire.Titre;
import ihm.Ihm_creation_questionnaire;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Font;
import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;
/**
*
* @author Binou
*/
public class ColorTableCellRenderer extends DefaultTableCellRenderer {
public Component getTableCellRendererComponent(JTable table,
Object value,
boolean isSelected,
boolean hasFocus,
int row,
int column) {
super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
if (Ihm_creation_questionnaire.leTypeQuestionnaire.getListeQuestionsTitres().get(row) instanceof Titre) {
if(((Titre)Ihm_creation_questionnaire.leTypeQuestionnaire.getListeQuestionsTitres().get(row)).getNiveauTitre()==1){
this.setBackground(new Color(101, 114, 235));
this.setForeground(Color.WHITE);
this.setSize(1,1);
Font f = new Font("Sheriff", Font.BOLD, 15);
this.setFont(f);
}
else if(((Titre)Ihm_creation_questionnaire.leTypeQuestionnaire.getListeQuestionsTitres().get(row)).getNiveauTitre()==2){
this.setBackground(new Color(142, 151, 235));
this.setForeground(Color.WHITE);
}
else if(((Titre)Ihm_creation_questionnaire.leTypeQuestionnaire.getListeQuestionsTitres().get(row)).getNiveauTitre()==3){
this.setBackground(new Color(178, 178, 241));
this.setForeground(Color.WHITE);
}
else if(((Titre)Ihm_creation_questionnaire.leTypeQuestionnaire.getListeQuestionsTitres().get(row)).getNiveauTitre()==3){
this.setBackground(new Color(101, 114, 235));
this.setForeground(Color.WHITE);
}
else if(((Titre)Ihm_creation_questionnaire.leTypeQuestionnaire.getListeQuestionsTitres().get(row)).getNiveauTitre()==3){
this.setBackground(new Color(101, 114, 235));
this.setForeground(Color.WHITE);
}
else{
if(Ihm_creation_questionnaire.jTableau.getSelectedRow()==row)
this.setBackground( new Color(184, 207, 229));
else
this.setBackground(Color.WHITE);
}
}else{
if(Ihm_creation_questionnaire.jTableau.getSelectedRow()==row)
this.setBackground( new Color(184, 207, 229));
else{
this.setBackground(Color.WHITE);
}
}
return this;
}
} |
Partager