@Override
    public @NotNull Dimension preferredLayoutSize(Container target) {
      Dimension dimension = super.preferredLayoutSize(target);
      int maxHeight = getMaxHeight();
      switchTimer(dimension.height > maxHeight);
      dimension.height = Math.min(maxHeight, dimension.height);
      return dimension;
    }
@Override
    public @NotNull Dimension preferredLayoutSize(Container target)