static F1 formLayouter_rightAligned() { ret func(Container parent) -> Dimension { L l = getComponents(parent); BitSet bitOnes = layouting_bigOnes(l); int nBigOnes = bigOnes.cardinality(); int mandatoryWidth = totalPreferredWidth(listWithoutIndicesInBitSet(l, bigOnes)); int gap = 4, outerSpacing = 5; Dimension size = parent.getSize(); int totalSpace = size.width-outerSpacing*2-(l(l)-1)*gap; int liberalSpace = totalSpace-mandatoryWidth; double perBigOne = doubleRatio(liberalSpace, nBigOnes); double x = nBigOnes == 0 ? size.width-outerSpacing-mandatoryWidth : outerSpacing; for i over l: { Component c = l.get(i); bool big = contains(bigOnes, i); double w = big ? perBigOne : c.getPreferredSize().width; int actualX = iround(x); c.setBounds(actualX, 10, iround(x+w)-actualX, size.height-outerSpacing*2); x += w+gap; } ret componentsBoundingSize(parent, outerSpacing); }; }