Witam
Mam następujący problem i nie wiem z czego to wynika . Więc ma jTable i chce pomalować wybrane komórki tylko ze jak odpalę program i przeskakuje miedzy komórkami(strzałkami) to zmienia kolor tak jak by przenosiło kolor z poprzedniej komórki nie wiem z czego to wynika . O to fragment kodu odpowiedzialny za kolor komórki .
Table_plan = new javax.swing.JTable(){
public Component prepareRenderer (TableCellRenderer renderer, int rowIndex, int columnIndex){
Component componenet = super.prepareRenderer(renderer, rowIndex, columnIndex);
Object value = getModel().getValueAt(rowIndex,columnIndex);
String wartosc = String.valueOf(value);
if(columnIndex == 1){
if(wartosc.contains("So") || wartosc.contains("N"))
{
componenet.setBackground(new Color (255, 255, 204));
componenet.setForeground(Color.BLACK);
maluj_dalej = true ;
}else if (maluj_dalej == true && wartosc.equals(" ")){
componenet.setBackground(new Color (255, 255, 204));
componenet.setForeground(Color.BLACK);
}else {
maluj_dalej=false ;
}
}else if (maluj_dalej==true && columnIndex != 1 ){
componenet.setBackground(new Color (255, 255, 204));
componenet.setForeground(Color.BLACK);
}
else {
componenet.setBackground(Color.WHITE);
componenet.setForeground(Color.BLACK);
}
return componenet;
}
}
;