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
|
private void combo_itemStateChanged(java.awt.event.ItemEvent e){
if(e.getStateChange() == ItemEvent.DESELECTED){
JComboBox c = (JComboBox)e.getSource();
Color c1 = new Color(0,0,0);
Color c2 = new Color(255,255,255);
Color c3 = new Color(255,0,0);
System.out.println( c.getParent());
for(int i = 0;i < this.getColumnCount();i++){
for(int j=0;j<this.getRowCount();j++){
if(this.getValueAt(j, i).toString().compareTo("1") == 0){
// custom.setBackground(c1);
c.getParent().setBackground(c1);
}
else if(this.getValueAt(j, i).toString().compareTo("2") == 0){
//custom.setBackground(c2);
c.setBackground(c2);
}
else if(this.getValueAt(j, i).toString().compareTo("-1") == 0){
//custom.setBackground(c3);
c.setBackground(c3);
//this.getColumnModel().getColumn(i).setCellRenderer(custom);
}
}
}
//custom.getTableCellRendererComponent(this, combo, false, true, 1, 1).setBackground(new Color(0,0,0));
}
} |
Partager