void (@NotNull Painter painter, JComponent dirtyComponent) { if (dirtyComponent != null && dirtyComponent.isShowing()) { Rectangle rec = SwingUtilities.convertRectangle(dirtyComponent, dirtyComponent.getBounds(), rootComponent); rootComponent.repaint(rec); } else { rootComponent.repaint(); } }