[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.swt] Where to get FormLayout please???

Veronika - I cannot resolve the FormLayout. Any help well appreciated.
Thanks.

"Veronika Irvine" <veronika_irvine@xxxxxxx> wrote in message
news:bfs24c$ins$1@xxxxxxxxxxxxxx
> See GC.copyArea. You can use this with Display:
>
> public static void main(String[] args) {
>  final Display display = new Display();
>  Shell shell = new Shell(display);
>  shell.setLayout(new FormLayout());
>  Button b = new Button(shell, SWT.PUSH);
>  b.setText("Take ScreenShot");
>  final Canvas c = new Canvas(shell, SWT.BORDER);
>  b.addListener(SWT.MouseDown, new Listener() {
>   public void handleEvent(Event e) {
>    Rectangle rect = display.getBounds();
>    Image image = new Image(display, rect.width, rect.height);
>    GC gc = new GC(display);
>    gc.copyArea(image, 0, 0);
>    gc.dispose();
>    gc = new GC(c);
>    gc.drawImage(image, 0, 0);
>    gc.dispose();
>    image.dispose();
>   }
>  });
>  FormData data = new FormData();
>  data.left = new FormAttachment(0, 10);
>  data.top = new FormAttachment(0, 10);
>  b.setLayoutData(data);
>  data = new FormData();
>  data.left = new FormAttachment(0, 10);
>  data.top = new FormAttachment(b, 10);
>  data.right = new FormAttachment(100, -10);
>  data.bottom = new FormAttachment(100, -10);
>  c.setLayoutData(data);
>  shell.open();
>  while (!shell.isDisposed()) {
>   if (!display.readAndDispatch())
>    display.sleep();
>  }
>  display.dispose();
> }
>
> "Willy" <pepe@xxxxxxxxx> wrote in message news:bfrv42$fdc$1@xxxxxxxxxxxxxx
> > HOWTO capture screen with SWT in win98 or linux?
> >
>
>