public int preferredHeight() {
      int totalHeight = 0;

      for (JComponent component : mySyncComponents) {
        Dimension size = getPreferredSize(component);
        totalHeight = Math.max(size.height, totalHeight);
      }

      if (myLastPreferredHeight != totalHeight) {
        myLastPreferredHeight = totalHeight;
        SwingUtilities.invokeLater(this::revalidateAll);
      }

      return totalHeight;
    }
public int preferredHeight()