As @kleopatra mentioned, i looked at my predicate:
HighlightPredicate spakowany = new HighlightPredicate() {
@Override
public boolean isHighlighted(Component renderer, ComponentAdapter adapter) {
TableModel tableModel = table.getModel();
if (tableModel instanceof StanTableModel) {
StanTableModel stanTableModel = (StanTableModel) tableModel;
// int rowIndex = adapter.row; <- this was the issue
int rowIndex = adapter.convertRowIndexToModel(adapter.row);
StanTableRow myCustomRow = stanTableModel.getRow(rowIndex);
if ((myCustomRow.isSpakowany()) {
return true;
}
}
return false;
}
};
and used @mKorbel idea:
was:
int rowIndex = adapter.row;
is now:
int rowIndex = adapter.convertRowIndexToModel(adapter.row);
And it works now.
StanTableModel is my custom table model. It has getRow() function and returns a StanTableRow object which in turn has isSpakowany() function.