SWT:分割窗口

来源:互联网 发布:淘宝店铺七天无理由 编辑:程序博客网 时间:2024/05/16 09:23
public static void showSashForm(Shell shell)
 {
  //创建窗框对象,设置样式为水平排列
  SashForm form = new SashForm(shell, SWT.HORIZONTAL | SWT.BORDER);
  //平滑外观
  //SashForm form = new SashForm(shell, SWT.HORIZONTAL | SWT.SMOOTH);
  //垂直放置
  //SashForm form = new SashForm(shell, SWT.VERTICAL | SWT.BORDER);
  
  form.setLayout(new FillLayout());
  //创建窗口1的面板
  Composite child1 = new Composite(form, SWT.NONE);
  child1.setLayout(new FillLayout());
  new Text(child1, SWT.MULTI).setText("窗口 1");
  //创建窗口2的面板
  Composite child2 = new Composite(form, SWT.NONE);
  child2.setLayout(new FillLayout());
  new Text(child2, SWT.MULTI).setText("窗口 2");
  //设置某一个控件最大化
  //form.setMaximizedControl(folder);
  //设置还原
  //form.setMaximizedControl(null);
  //设置初始状态两个面板所占的比例
  form.setWeights(new int[]{30, 70});
  //设置窗口显示的比例
  //form.setWeights(new int[]{30, 30, 40});
 }
原创粉丝点击