sclass StackLayouter extends F1 { Map heights = weakHashMap(); int gap = 5; //int defaultHeight = 50; int preferredWidth = 300; bool maximizeIfSingleComponent = true; Dimension get(Container parent) { L l = getComponents(parent); Insets insets = unnullInsets(parent.getInsets()); Dimension size = parent.getSize(); ifdef StackLayouter_debug print("StackLayouter: n=" + l(l) + ", insets=" + insets + ", size=" + size); endifdef int y = insets.top; int width = size.width-insets.left-insets.right; for (Component c : l) { Int H; if (maximizeIfSingleComponent && l(l) == 1) { ifdef StackLayouter_debug print("StackLayouter maximizing!"); endifdef H = size.height-insets.bottom-y; } else H = heights.get(c); int h = H != null ? H : c.getPreferredSize().height; c.setBounds(insets.left, y, width, h); y += h+gap; ifdef StackLayouter_debug print("StackLayouter: y=" + y + ", h=" + h); endifdef } // return preferred size (hm.) ret new Dimension(preferredWidth, max(50 /* XXX */, y+insets.bottom-gap)); }; }