Don't use selected row, but target row for selection

This commit is contained in:
SiboVG 2023-09-17 18:43:37 +02:00
parent 9ac7f9bb99
commit 7305670fb0

View File

@ -74,14 +74,13 @@ public class ComponentPresetTable extends JTable {
@Override @Override
public void setValueAt(Object aValue, int rowIndex, int columnIndex) { public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
// Only support favorite // Only support favorite
if ( columnIndex != 0 ) { if (columnIndex != 0) {
return; return;
} }
int selectedRow = ComponentPresetTable.this.getSelectedRow();
ComponentPreset preset = ComponentPresetTable.this.presets.get(rowIndex); ComponentPreset preset = ComponentPresetTable.this.presets.get(rowIndex);
Application.getComponentPresetDao().setFavorite(preset, presetType, (Boolean) aValue); Application.getComponentPresetDao().setFavorite(preset, presetType, (Boolean) aValue);
ComponentPresetTable.this.updateFavorites(); ComponentPresetTable.this.updateFavorites();
ComponentPresetTable.this.setRowSelectionInterval(selectedRow, selectedRow); ComponentPresetTable.this.setRowSelectionInterval(rowIndex, rowIndex);
} }
@Override @Override