Skip to content

Commit

Permalink
'#2391: Force the repaint of gallery single selected item.
Browse files Browse the repository at this point in the history
  • Loading branch information
wladimirleite committed Dec 30, 2024
1 parent 9919563 commit f3f5292
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions 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 @@ -79,6 +80,25 @@ public void changeSelection(int rowIndex, int columnIndex, boolean toggle, boole
super.changeSelection(rowIndex, columnIndex, toggle, extend);
}

@Override
public void repaint() {
// Before calling the actual repaint(), force the repaint of current selected
// cell. If a single cell is selected, sometimes its content is not refreshed
// after calling the regular repaint();
// See issue #2391.
if (getModel() != null && getSelectionModel() != null) {
int col = getSelectedColumn();
int row = getSelectedRow();
if (row >= 0 && col >= 0) {
TableCellEditor editor = getCellEditor(row, col);
if (editor != null) {
editor.stopCellEditing();
}
}
}
super.repaint();
}

public int getLeadSelectionIndex() {
if (selectedCells.get(lead)) {
return lead;
Expand Down

0 comments on commit f3f5292

Please sign in to comment.