!7 abstract sclass AbstractLayoutManager implements LayoutManager { Dimension preferredSize = new Dimension(100, 100); public void addLayoutComponent(String name, Component comp) {} public void removeLayoutComponent(Component comp) {} public Dimension preferredLayoutSize(Container parent) { print("preferredLayoutSize called"); ret preferredSize; } public Dimension minimumLayoutSize(Container parent) { print("minimumLayoutSize called"); ret new Dimension(10, 10); } } p-substance { JPanel panel = new JPanel(new AbstractLayoutManager { public void layoutContainer(Container parent) { print("layoutContainer called"); int y = 10; for (Component c : parent.getComponents()) { int h = c.getPreferredSize().height; c.setBounds(10, y, 300, h); y += h + 10; } preferredSize = componentsBoundingSize(parent, 10); } }); for i to 10: panel.add(jtextfield()); print("components added"); showFrame(jscroll_centered(panel)); }