sashes[i - 1].setBounds(area.x, y, area.width, SASH_WIDTH); y += SASH_WIDTH;
sashes[i - 1].setBounds(area.x, y, area.width, sashwidth); y += sashwidth;
public void layout(boolean changed) {	checkWidget();	Rectangle area = getClientArea();	if (area.width == 0 || area.height == 0) return;		Control[] newControls = getControls(true);	if (controls.length == 0 && newControls.length == 0) return;	controls = newControls;		if (maxControl != null && !maxControl.isDisposed()) {		for (int i= 0; i < controls.length; i++){			if (controls[i] != maxControl) {				controls[i].setBounds(-200, -200, 0, 0);			} else {				controls[i].setBounds(area);			}		}		return;	}		// keep just the right number of sashes	if (sashes.length < controls.length - 1) {		Sash[] newSashes = new Sash[controls.length - 1];		System.arraycopy(sashes, 0, newSashes, 0, sashes.length);		int sashStyle = (orientation == SWT.HORIZONTAL) ? SWT.VERTICAL : SWT.HORIZONTAL;		if ((getStyle() & SWT.BORDER) != 0) sashStyle |= SWT.BORDER;		for (int i = sashes.length; i < newSashes.length; i++) {			newSashes[i] = new Sash(this, sashStyle);			newSashes[i].addListener(SWT.Selection, sashListener);		}		sashes = newSashes;	}	if (sashes.length > controls.length - 1) {		if (controls.length == 0) {			for (int i = 0; i < sashes.length; i++) {				sashes[i].dispose();			}			sashes = new Sash[0];		} else {			Sash[] newSashes = new Sash[controls.length - 1];			System.arraycopy(sashes, 0, newSashes, 0, newSashes.length);			for (int i = controls.length - 1; i < sashes.length; i++) {				sashes[i].dispose();			}			sashes = newSashes;		}	}		if (controls.length == 0) return;		// get the ratios	long[] ratios = new long[controls.length];	long total = 0;	for (int i = 0; i < controls.length; i++) {		Long ratio = (Long)controls[i].getData(LAYOUT_RATIO);		if (ratio != null) {			ratios[i] = ratio.longValue();		} else {			ratios[i] = ((200 << 16) + 999) / 1000;		}		total += ratios[i];	}		if (orientation == SWT.HORIZONTAL) {		total += (((long)(sashes.length * SASH_WIDTH) << 16) + area.width - 1) / area.width;	} else {		total += (((long)(sashes.length * SASH_WIDTH) << 16) + area.height - 1) / area.height;	}	if (orientation == SWT.HORIZONTAL) {		int width = (int)(ratios[0] * area.width / total);		int x = area.x;		controls[0].setBounds(x, area.y, width, area.height);		x += width;		for (int i = 1; i < controls.length - 1; i++) {			sashes[i - 1].setBounds(x, area.y, SASH_WIDTH, area.height);			x += SASH_WIDTH;			width = (int)(ratios[i] * area.width / total);			controls[i].setBounds(x, area.y, width, area.height);			x += width;		}		if (controls.length > 1) {			sashes[sashes.length - 1].setBounds(x, area.y, SASH_WIDTH, area.height);			x += SASH_WIDTH;			width = area.width - x;			controls[controls.length - 1].setBounds(x, area.y, width, area.height);		}	} else {		int height = (int)(ratios[0] * area.height / total);		int y = area.y;		controls[0].setBounds(area.x, y, area.width, height);		y += height;		for (int i = 1; i < controls.length - 1; i++) {			sashes[i - 1].setBounds(area.x, y, area.width, SASH_WIDTH);			y += SASH_WIDTH;			height = (int)(ratios[i] * area.height / total);			controls[i].setBounds(area.x, y, area.width, height);			y += height;		}		if (controls.length > 1) {			sashes[sashes.length - 1].setBounds(area.x, y, area.width, SASH_WIDTH);			y += SASH_WIDTH;			height = area.height - y;			controls[controls.length - 1].setBounds(area.x, y, area.width, height);		}	}}