JavaTableCellRenderer Showing Stange Behaviour
===

I am rendering a treetable (each node expands). Its a static table and I need to highlight certain cells. When I do that using jTable's TableCellRenderer, it shows strange behavior. For example, when there are three columns, it unnecessarily highlights a particular cell in first column and when there are four columns, it highlights two particular cells in first column. I dont want to highlight any cell in the first column. I use following code:

    public Component prepareRenderer(TableCellRenderer renderer, int index_row, int index_col)
			  {
				  Component comp = super.prepareRenderer(renderer, index_row, index_col);
				 
				  comp.setBackground(Color.white);
				  
				  Object obj1 = getModel().getValueAt(index_row, index_col);
				  
				  if (!obj1.toString().equals(getModel().getValueAt(index_row, 1)))
				  {
					  if (obj1.toString().equals(" ") )
					  {
						  comp.setBackground(Color.red);
					  }
					  
					  else if (index_col != 0)
					  {
						  comp.setBackground(Color.green);
					  }
				  }
				  
				  
				  return comp;
			  }	


Any help will be greatly appreciated. Thanks...
