code: protected DimenInfo computeDimens (Container parent, int type) {
          int count = parent.getComponentCount();
          DimenInfo info = new DimenInfo();
          info.dimens = new Dimension[count];
  
          for (int i = 0; i < count; i++) {
              Component child = parent.getComponent(i);
              if (!child.isVisible()) {
                  continue;
              }
  
              Dimension csize;
              switch  (type) {
              case MINIMUM:
                  csize = child.getMinimumSize();
                  break;
  
              case MAXIMUM:
                  csize = child.getMaximumSize();
                  break;
  
              default:
                  csize = child.getPreferredSize();
                  break;
              }
  
              info.count++;
              info.totwid += csize.width;
              info.tothei += csize.height;
  
              if (csize.width > info.maxwid) {
                  info.maxwid = csize.width;
              }
              if (csize.height > info.maxhei) {
                  info.maxhei = csize.height;
              }
  
              Constraints c = getConstraints(child);
              if (c.isFixed()) {
                  info.fixwid += csize.width;
                  info.fixhei += csize.height;
                  info.numfix++;
  
              } else {
                  info.totweight += c.getWeight();
  
                  if (csize.width > info.maxfreewid) {
                      info.maxfreewid = csize.width;
                  }
                  if (csize.height > info.maxfreehei) {
                      info.maxfreehei = csize.height;
                  }
              }
  
              info.dimens[i] = csize;
          }
  
          return info;
      }
docs: Computes dimensions of the children widgets that are useful for the
  group layout managers.