Hi,
Currently I'm not changing those property at all.
I try set them in all combination - TRUE/TRUE, TRUE/FALSE, FALSE/TRUE, FALSE/ FALSE, and doesn't seem to have effect.
however if I comment the 2 method overridden - prepareRenderer and isCellSelected, then it is highlight the row.
import java.awt.*;
import java.util.ArrayList;
import javax.swing.JTable;
import javax.swing.table.TableCellRenderer;
public class BaseAbstractTable extends JTable
{
private BaseAbstractTableModel baseTableModel;
private ArrayList<Boolean> fillRow_Arr;
public BaseAbstractTable(BaseAbstractTableModel p_tableModel, ArrayList<Boolean> p_fillRow_Arr)
{
super(p_tableModel);
baseTableModel=p_tableModel;
fillRow_Arr=p_fillRow_Arr;
//setCellSelectionEnabled(false);
//setRowSelectionAllowed(true);
}
public Component prepareRenderer(TableCellRenderer renderer,int row, int col)
{
Component comp = super.prepareRenderer(renderer, row, col);
if(baseTableModel.getRowElement_Map().get(row)==null)
{
comp.setBackground(Color.LIGHT_GRAY);
comp.setForeground(Color.BLUE);
comp.setFont(new Font("HELVETICA", Font.BOLD, 16));
}
else if(fillRow_Arr!=null && !fillRow_Arr.get(row))
{
comp.setBackground(Color.ORANGE);
}
else
comp.setBackground(Color.WHITE);
return comp;
}
public boolean isCellSelected(int row, int col)
{
return true;
}
}