y += cellHeight;
g.setColor(ERROR_COLOR);
for (int i = 0; i < rows; i++) {
for (int j = 0; j < cols; j++) {
int row = getTableRow(i, j, rows, cols);
Entry entry = table.getOutputEntry(row, outputColumn);
if (provisionalValue != null && row == provisionalY
&& outputColumn == provisionalX) entry = provisionalValue;
if (entry.isError()) {
g.fillRect(x + j * cellWidth, y + i * cellHeight, cellWidth, cellHeight);
}
}
}
List<Implicant> implicants = model.getOutputExpressions().getMinimalImplicants(output);
if (implicants != null) {
int index = 0;
for (Implicant imp : implicants) {
g.setColor(IMP_COLORS[index % IMP_COLORS.length]);
paintImplicant(g, imp, x, y, rows, cols);
index++;
}
}
g.setColor(Color.GRAY);
if (cols > 1 || inputCount == 0) {
g.drawLine(x, y, left + tableWidth, y);
}
if (rows > 1 || inputCount == 0) {
g.drawLine(x, y, x, top + tableHeight);
}
if (outputColumn < 0) {
return;
}
g.setColor(Color.BLACK);
for (int i = 0; i < rows; i++) {
for (int j = 0; j < cols; j++) {
int row = getTableRow(i, j, rows, cols);
if (provisionalValue != null && row == provisionalY
&& outputColumn == provisionalX) {
String text = provisionalValue.getDescription();
g.setColor(Color.GREEN);
g.drawString(text,
x + j * cellWidth + (cellWidth - fm.stringWidth(text)) / 2,
y + i * cellHeight + dy);
g.setColor(Color.BLACK);
} else {
Entry entry = table.getOutputEntry(row, outputColumn);
String text = entry.getDescription();
g.drawString(text,
x + j * cellWidth + (cellWidth - fm.stringWidth(text)) / 2,
y + i * cellHeight + dy);
}
}