void () { int width = getWidth(); int height = getHeight(); JComponent[] components = new JComponent[]{myContents.get(0), myDivider1, myContents.get(1), myDivider2, myContents.get(2)}; int[] contentWidths = calcComponentsWidths(width, myProportion1, myProportion2); int x = 0; for (int i = 0; i < 5; i++) { JComponent component = components[i]; component.setBounds(x, 0, contentWidths[i], height); component.validate(); x += contentWidths[i]; } }