Shell: getClientArea() : Shell « org.eclipse.swt.widgets « Java by API






Shell: getClientArea()


import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;

public class MainClass {

  public static void main(String[] a) {
    Display display = new Display();
    Shell shell = new Shell(display);
    Label label = new Label(shell, SWT.CENTER);
    label.setText("Hello, World");
    label.setBounds(shell.getClientArea());
    shell.open();
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) {
        display.sleep();
      }
    }
    display.dispose();
  }
}

           
       








Related examples in the same category

1.new Shell(shell, SWT.APPLICATION_MODAL | SWT.DIALOG_TRIM) (Make shell a dialog)
2.new Shell(Display arg0)
3.new Shell(Display display, int style)
4.new Shell(Shell parent)
5.Shell: getDisplay()
6.Shell: open()
7.Shell: setImage(Image img)
8.Shell: setMenuBar(Menu menu)
9.Shell: setRegion(Region reg)
10.Shell: setSize(int width, int height)