ATuin

Two simple windows splitted with Sash - Java

Mar 27th, 2012
155
0
Never
7
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.44 KB | None | 0 0
  1. import org.eclipse.swt.*;c
  2. import org.eclipse.swt.layout.*;
  3. import org.eclipse.swt.widgets.*;
  4. import org.eclipse.swt.widgets.Event;
  5. public class SashExample {
  6.  
  7.   public void run() {
  8.   Display display = new Display();
  9.   Shell shell = new Shell(display);
  10.   shell.setText("Show Sash ");
  11.   create(shell);
  12.   shell.pack();
  13.   shell.open();
  14.   while (!shell.isDisposed()) {
  15.   if (!display.readAndDispatch()) {
  16.   display.sleep();
  17.   }
  18.   }
  19.   display.dispose();
  20.   }
  21.   public void create(Composite composite) {
  22.   composite.setLayout(new FormLayout());
  23.  
  24.   final Sash sash = new Sash(composite, SWT.VERTICAL);
  25.   FormData data = new FormData();
  26.   data.top = new FormAttachment(0, 0);
  27.   data.bottom = new FormAttachment(100, 0);
  28.   data.left = new FormAttachment(50, 0);
  29.   sash.setLayoutData(data);
  30.  
  31.   Text text1 = new Text(composite, SWT.BORDER |  SWT.WRAP);
  32.   data = new FormData();
  33.   data.top = new FormAttachment(0, 0);
  34.   data.bottom = new FormAttachment(100, 0);
  35.   data.left = new FormAttachment(0, 0);
  36.   data.right = new FormAttachment(sash, 0);
  37.   text1.setLayoutData(data);
  38.  
  39.   Text text2 = new Text(composite, SWT.BORDER|  SWT.WRAP);
  40.   data = new FormData();
  41.   data.top = new FormAttachment(0, 0);
  42.   data.bottom = new FormAttachment(100, 0);
  43.   data.left = new FormAttachment(sash, 0);
  44.   data.right = new FormAttachment(100, 0);
  45.   text2.setLayoutData(data);
  46. }
  47.   public static void main(String[] args) {
  48.   new SashExample().run();
  49.   }
  50. }
Advertisement
Comments
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
Add Comment
Please, Sign In to add comment