void () { Rectangle r = getBounds(); for (Component component : getComponents()) { if (component instanceof JScrollPane) { component.setBounds(0, 0, r.width, r.height); } else { Dimension d = component.getPreferredSize(); component.setBounds(r.width - d.width - 2, r.height - d.height - 7, d.width, d.height); } } }