override fun prepareRenderer()

in code/smv-debugger/src/main/kotlin/org/fbme/smvDebugger/panel/items/HighlightedTable.kt [15:32]


    override fun prepareRenderer(renderer: TableCellRenderer, rowIndex: Int, columnIndex: Int): Component {
        val component = super.prepareRenderer(renderer, rowIndex, columnIndex)
        if (component.background != getSelectionBackground()) {
            var color = DEFAULT_CELL_COLOR
            if (columnIndex == currentColumnIndex) {
                color = CURRENT_COLUMN_COLOR
            }
            if (columnIndex > 1) {
                val curValue = getValueAt(rowIndex, columnIndex) as String
                val prevValue = getValueAt(rowIndex, columnIndex - 1) as String
                if (curValue != prevValue) {
                    color = HIGHLIGHT_CELL_COLOR
                }
            }
            component.background = color
        }
        return component
    }