void (@NotNull TableModelEvent e) { final int signum; switch (e.getType()) { case TableModelEvent.INSERT -> signum = 1; case TableModelEvent.DELETE -> { signum = -1; for (int i = e.getLastRow(); i >= e.getFirstRow(); i--) { myComponents.remove(i); } } default -> { return; } } int shift = Math.abs(e.getFirstRow() - e.getLastRow() + 1) * signum; myComponents.shiftKeys(e.getFirstRow(), shift); if (myRowUnderMouse >= e.getFirstRow()) { myRowUnderMouse = -1; } if (getModel().getSize() > 0) { repaintRows(0, getModel().getSize() - 1, false); } }