import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.*;
import org.eclipse.swt.custom.CBanner;
import org.eclipse.swt.layout.*;
public class B{
public static void main(String[] args){
Display display=new Display();
Shell shell=new Shell(display);
shell.setText("自定义分割框CBanner");
FillLayout layout=new FillLayout();
layout.marginHeight=20;
layout.marginWidth=20;
shell.setLayout(layout);//必须要有
//shell.setLayout(new FillLayout(SWT.HORIZONTAL));//必须要有
//自定义分割框像是SashForm的变体,有三个控件,分别放在窗口的左侧left右侧right和底部bottom
//创建CBanner对象
CBanner banner=new CBanner(shell,SWT.BORDER);
banner.setLayout(new FillLayout());
//创建三个面板,分别放置在左侧,右侧和下部
Composite left=new Composite(banner,SWT.NONE);
left.setLayout(new FillLayout());
new Text(left,SWT.MULTI).setText("左侧");
Composite right=new Composite(banner,SWT.NONE);
right.setLayout(new FillLayout());
new Text(right,SWT.MULTI).setText("右侧");
Composite bottom=new Composite(banner,SWT.NONE);
bottom.setLayout(new FillLayout());
new Text(bottom,SWT.MULTI).setText("下部");
//设置左侧的控件
banner.setLeft(left);
banner.setRight(right);
banner.setBottom(bottom);
//改变分割线的外观,特指的是左右两侧的分割线是直线的还是平滑的,默认是直线
//banner.setSimple(false);
//打开窗口,进行窗口的显示
shell.setSize(400,400);
//shell.pack();
shell.open();
while(!shell.isDisposed()){
//当窗口没有被释放的时候
if(!display.readAndDispatch()){
display.sleep();
}
}
display.dispose();
}
}