void (Container parent) { int w = getVisibleWidth(); Dimension ls = myLeftComponent.getPreferredSize(); Dimension rs = myRightComponent.getPreferredSize(); int lw = w - rs.width - 10; int rw = rs.width; myLeftComponent.setBounds(0, 0, lw, ls.height); myRightComponent.setBounds(w - rw, 0, rw, rs.height); }