Sashes : Sash « SWT « Java Tutorial






Sashes, also called splitters

  1. Sashes can be horizontal or vertical;
  2. The type is determined at construction time, and cannot be changed.
  3. The default is vertical.
  4. Passing SWT.HORIZONTAL or SWT.VERTICAL to the constructor determines the type:
Sash horizontalSash = new Sash(shell, SWT.HORIZONTAL); // Horizontal sash
Sash verticalSash = new Sash(shell, SWT.VERTICAL); // Vertical sash
Sashes
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Sash;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;

public class SashVerticalHori {
  public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell(display);
    shell.setText("Sash One");

    shell.setLayout(new FillLayout());
    new Text(shell, SWT.BORDER);
    new Sash(shell, SWT.HORIZONTAL);
    new Text(shell, SWT.BORDER);

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

  }
}








17.83.Sash
17.83.1.SashesSashes
17.83.2.Make Split Dragger slimMake Split Dragger slim
17.83.3.Making a Sash StickMaking a Sash Stick
17.83.4.Sash: implement a simple splitter (with a 20 pixel limit)Sash: implement a simple splitter (with a 20 pixel limit)