Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import org.eclipse.swt.*;c
- import org.eclipse.swt.layout.*;
- import org.eclipse.swt.widgets.*;
- import org.eclipse.swt.widgets.Event;
- public class SashExample {
- public void run() {
- Display display = new Display();
- Shell shell = new Shell(display);
- shell.setText("Show Sash ");
- create(shell);
- shell.pack();
- shell.open();
- while (!shell.isDisposed()) {
- if (!display.readAndDispatch()) {
- display.sleep();
- }
- }
- display.dispose();
- }
- public void create(Composite composite) {
- composite.setLayout(new FormLayout());
- final Sash sash = new Sash(composite, SWT.VERTICAL);
- FormData data = new FormData();
- data.top = new FormAttachment(0, 0);
- data.bottom = new FormAttachment(100, 0);
- data.left = new FormAttachment(50, 0);
- sash.setLayoutData(data);
- Text text1 = new Text(composite, SWT.BORDER | SWT.WRAP);
- data = new FormData();
- data.top = new FormAttachment(0, 0);
- data.bottom = new FormAttachment(100, 0);
- data.left = new FormAttachment(0, 0);
- data.right = new FormAttachment(sash, 0);
- text1.setLayoutData(data);
- Text text2 = new Text(composite, SWT.BORDER| SWT.WRAP);
- data = new FormData();
- data.top = new FormAttachment(0, 0);
- data.bottom = new FormAttachment(100, 0);
- data.left = new FormAttachment(sash, 0);
- data.right = new FormAttachment(100, 0);
- text2.setLayoutData(data);
- }
- public static void main(String[] args) {
- new SashExample().run();
- }
- }
Advertisement