if (isSelected)
if (isSelected && hasFocus) { setBackground(table.getBackground()); setForeground(table.getSelectionForeground()); } else if (table.isRowSelected(row))
  public Component getTableCellRendererComponent(JTable table, Object value,                                                 boolean isSelected,                                                 boolean hasFocus,                                                 int row, int column)  {    if (value != null)      {        if (value instanceof JTextField)          return new JTextField(((JTextField)value).getText());      super.setText(value.toString());      }        setOpaque(true);    if (table == null)      return this;    if (isSelected)      {        setBackground(table.getSelectionBackground());        setForeground(table.getSelectionForeground());      }    else      {        setBackground(table.getBackground());        setForeground(table.getForeground());      }    setEnabled(table.isEnabled());    setFont(table.getFont());    return this;  }