private JViewport getViewport() {
    Component parent = getParent();
    if (parent instanceof JScrollPane pane) {
      return pane.getViewport();
    }
    return null;
  }
private JViewport getViewport()