private static @Nullable JScrollBar findVerticalScrollBar(@Nullable Component component) {
    if (component == null) {
      return null;
    }
    if (component instanceof JScrollPane) {
      JScrollBar scrollBar = ((JScrollPane)component).getVerticalScrollBar();
      return scrollBar != null && scrollBar.isVisible() ? scrollBar : null;
    }
    if (isDiagramViewComponent(component)) {
      JComponent view = (JComponent)component;
      for (int i = 0; i < view.getComponentCount(); i++) {
        if (view.getComponent(i) instanceof JScrollBar scrollBar) {
          if (scrollBar.getOrientation() == Adjustable.VERTICAL) {
            return scrollBar.isVisible() ? scrollBar : null;
          }
        }
      }
    }
    return findVerticalScrollBar(component.getParent());
  }
private static @Nullable JScrollBar findVerticalScrollBar(@Nullable Component component)