I'm trying to write a method which for given parameters (value, color), sets color on the background of a cell which has value equal to cellValue.
What my method actually does is, it sets color on the background of a cells for whole row and when I select the row on the table, and I want method to only set color at specific column (where cellValue is equal to value) each time I call the method.
void setCellBackgroundColor(boolean cellValue, final Color color) {
List<List<Object>> data = tView.getTTableModel().getData();
for (int row = 0; row < data.size(); row++) {
for (int col = 0; col < data.get(row).size(); col++) {
TableCellRenderer renderer = tView.table.getCellRenderer(row, Col);
Component component = tView.table.prepareRenderer(renderer, row, col);
boolean bValue =
TDataTypeRenderer.parseIntoRealValue(
data.get(row).get(col)
)
);
if (bValue == cellValue) {
component.setBackground(color);
}
}