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