static F1 formLayouter2(O... _) { int yplus = optPar yPlus(_, 5); // make higher (bug fixing) int fixer2 = optPar fixer2(_, 0); int rightMargin = optPar rightMargin(_, 10); ret func(Container parent) -> Dimension { L l = getComponents(parent); new BitSet bigOnes; for i over l: if (containsATextArea(l.get(i))) add(bigOnes, i); int nBigOnes = bigOnes.cardinality(); int mandatoryHeight = totalPreferredHeight(listWithoutIndicesInBitSet(l, bigOnes)); int gap = 4, outerSpacing = 5; Dimension size = parent.getSize(); int gapsAndMargins = outerSpacing*2-(l(l)-1)*gap; int totalSpace = size.height-gapsAndMargins-fixer2; int liberalSpace = totalSpace-mandatoryHeight; int width = size.width-outerSpacing*2-rightMargin; double perBigOne = doubleRatio(liberalSpace, nBigOnes); double y = outerSpacing; for i over l: { Component c = l.get(i); bool big = contains(bigOnes, i); double h = big ? perBigOne : c.getPreferredSize().height; int actualY = iround(y); c.setBounds(10, actualY, width, iround(y+h)-actualY); y += h+gap; } // return preferred size Dimension pref = componentsBoundingSize(parent, outerSpacing); if (parent.getHeight() == 0) // pre-showing - maybe we should always do this pref.height = totalPreferredHeight(l)+gapsAndMargins+yplus; ret pref; }; }