private static int calcIconsWidth(List<? extends Icon> icons, int gapBetweenIcons) {
    int res = 0;
    for (Icon icon : icons) {
      if (res > 0) res += gapBetweenIcons;
      res += icon.getIconWidth();
    }
    return res;
  }
private static int calcIconsWidth(List<? extends Icon> icons, int gapBetweenIcons)