SWT/Jface Decorations 可以内嵌窗口 很神奇的

来源:互联网 发布:c语言图形化编程 编辑:程序博客网 时间:2024/05/05 11:20

/**
 * @Description: TODO
 * @author zouxs
 * @date 2012-10-17
 */
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Decorations;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;


public class HelloWorldDecorations {

 public static void main(String[] args) {
  Display display = new Display();
  Shell shell = new Shell(display);
  shell.setText("Hello World");
  shell.setSize(200, 100);
  FillLayout layout = new FillLayout();
  shell.setLayout(layout);
  Decorations deco = new Decorations(shell,SWT.BORDER|SWT.MIN);
  Label l1 = new Label(shell, SWT.BORDER);
  l1.setText("Hello World");


 // shell.pack();
  shell.open();
  while (!shell.isDisposed()) {
   if (!display.readAndDispatch())
    display.sleep();
  }
  display.dispose();

 }

}
效果如下:

原创粉丝点击