<更新記録>
2007年 12月 11日
作成

姉妹サイト検索 Web検索


FillLayout

FillLayout

FillLayoutは、コンポジットの領域全体を、その保持するControlを一列に並べて満たす(fill)レイアウト です。 FillLayoutには、 SWT_HORIZONTALもしくはSWT_VERTICALのスタイルを指定することができ、 Controlを横並びに表示するか、縦並びに表示するかを決めることが可能です。 また、ウィンドウのサイズを変更等しても、常にコンポジットを満たすように、そこに格納されるコントロールの大きさも動的に変化します。

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;

public class FillLayoutComposite extends Composite {

	public FillLayoutComposite(Composite parent) {
		super(parent, SWT.NONE);
		
		FillLayout layout = new FillLayout(SWT.HORIZONTAL);
		setLayout(layout);
		
		for (int i=0 ; i<5 ; i++) {
			Button button = new Button(this, SWT.NONE);
			button.setText("button" + i);
		}
		
		pack();
	}
}


Powered by VeryEasyCMS