Layout term: bounds, client area : Layout Basics « SWT « Java Tutorial






Layout term: bounds, client area
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

public class LayoutTerm {
  public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell(display);

    System.out.println("Bounds: " + shell.getBounds());
    System.out.println("Client area: " + shell.getClientArea());

    shell.setBackground(display.getSystemColor(SWT.COLOR_WHITE));

    RowLayout rowLayout = new RowLayout();

    shell.setLayout(rowLayout);

    Button button1 = new Button(shell, SWT.PUSH);
    button1.setText("button1");

    Button button2 = new Button(shell, SWT.PUSH);
    button2.setText("button2");

    Button button3 = new Button(shell, SWT.PUSH);
    button3.setText("button33333333333333333333333333333333333333");

    shell.pack();
    shell.open();

    System.out.println("button1: " + button1.getBounds());
    System.out.println("button2: " + button2.getBounds());

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








17.93.Layout Basics
17.93.1.Layouts
17.93.2.A few terms that are used frequently when discussing layouts
17.93.3.Setting Layouts
17.93.4.Using Layout Data Objects to control layoutUsing Layout Data Objects to control layout
17.93.5.Laying Out Children of a CompositeLaying Out Children of a Composite
17.93.6.Layout term: bounds, client areaLayout term: bounds, client area