public static void showRowLayout(Shell shell)
{
RowLayout layout = new RowLayout();
//设置填充方式
layout.type = SWT.HORIZONTAL; //设置水平填充 默认为水平,
//设置补白和间隔 默认状态为3
layout.marginLeft = 5; //左补白
layout.marginTop = 5; //上补白
layout.marginRight = 5; //右补白
layout.marginBottom = 5; //下补白
layout.spacing = 2; //控件的间隙
//设置是否充满整行
layout.justify = true; //默认为false;
//设置折行显示
layout.wrap = true;
//设置空间大小
layout.pack = false; //默认为true
//设置控件的大小RowData
Button b = new Button(shell, SWT.NONE);
b.setText("B1");
//设置按钮宽为100像素,高为30像素
b.setLayoutData(new RowData(100, 30));
//设置是否等宽或等高
layout.fill = true; //默认为false
shell.setLayout(layout);
new Button(shell, SWT.NONE).setText("B1");
new Button(shell, SWT.NONE).setText("Button2");
new Button(shell, SWT.NONE).setText("Wide Button3");
new Button(shell, SWT.NONE).setText("B4");
shell.layout();
}
{
RowLayout layout = new RowLayout();
//设置填充方式
layout.type = SWT.HORIZONTAL; //设置水平填充 默认为水平,
//设置补白和间隔 默认状态为3
layout.marginLeft = 5; //左补白
layout.marginTop = 5; //上补白
layout.marginRight = 5; //右补白
layout.marginBottom = 5; //下补白
layout.spacing = 2; //控件的间隙
//设置是否充满整行
layout.justify = true; //默认为false;
//设置折行显示
layout.wrap = true;
//设置空间大小
layout.pack = false; //默认为true
//设置控件的大小RowData
Button b = new Button(shell, SWT.NONE);
b.setText("B1");
//设置按钮宽为100像素,高为30像素
b.setLayoutData(new RowData(100, 30));
//设置是否等宽或等高
layout.fill = true; //默认为false
shell.setLayout(layout);
new Button(shell, SWT.NONE).setText("B1");
new Button(shell, SWT.NONE).setText("Button2");
new Button(shell, SWT.NONE).setText("Wide Button3");
new Button(shell, SWT.NONE).setText("B4");
shell.layout();
}