private static AboveBelow getBaselineAboveBelow(ArrayList<CompWrap> compWraps, int sType, boolean centerBaseline) { int maxAbove = Integer.MIN_VALUE; int maxBelow = Integer.MIN_VALUE; for (CompWrap cw : compWraps) { int height = cw.getSize(sType, false); if (height >= LayoutUtil.INF) return new AboveBelow(LayoutUtil.INF / 2, LayoutUtil.INF / 2); int baseline = cw.getBaseline(sType); int above = baseline + cw.getGapBefore(sType, false); maxAbove = Math.max(above, maxAbove); maxBelow = Math.max(height - baseline + cw.getGapAfter(sType, false), maxBelow); if (centerBaseline) cw.setDimBounds(-baseline, height, false); } return new AboveBelow(maxAbove, maxBelow); }