Hello,
I am trying to create a simple Sudoku game and want to change the color of a cell in a table to light gray. My TableCellRender is below. Does anyone have a way to do this?
Thank you,
Ken
class ElementRenderer extends JLabel implements TableCellRenderer {
public Component getTableCellRendererComponent(
JTable table, Object color,
boolean isSelected, boolean hasFocus,
int row, int column) {
//Find integer value in array, convert to
string and make part of label
JLabel theElement = new JLabel(arrayMatrix[row][column].toString(),CENTER);
setOpaque(true);
theElement.setFont(theFont);
setBackground(Color.BLACK);
return theElement;
//return this;
}
}