Skip to content

Commit

Permalink
'#1866: Workaround to repaint the currently selected cell.
Browse files Browse the repository at this point in the history
  • Loading branch information
wladimirleite committed Sep 12, 2023
1 parent b157708 commit 4c0d82c
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion iped-app/src/main/java/iped/app/ui/GalleryTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import javax.swing.JTable;
import javax.swing.KeyStroke;
import javax.swing.UIManager;
import javax.swing.table.TableCellEditor;
import javax.swing.table.TableModel;

public class GalleryTable extends JTable {
Expand Down Expand Up @@ -38,7 +39,18 @@ public void updateUI() {
setBackground(UIManager.getColor("Gallery.background"));
super.updateUI();
}


@Override
public void repaint() {
// When repainting the gallery table, sometimes the current selected cell was
// not repainted. Stopping the cell editing seems to minimize (fix?) this issue.
TableCellEditor editor = getCellEditor();
if (editor != null) {
editor.stopCellEditing();
}
super.repaint();
}

@Override
public void changeSelection(int rowIndex, int columnIndex, boolean toggle, boolean extend) {
int currentCell = rowIndex * this.getColumnCount() + columnIndex;
Expand Down

0 comments on commit 4c0d82c

Please sign in to comment.