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

时间:2021-11-18 01:18:54

/**
 * @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();

 }

}
效果如下:

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