aspektors

Untitled

May 29th, 2012
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.89 KB | None | 0 0
  1. import org.eclipse.swt.*;
  2. import org.eclipse.swt.graphics.Rectangle;
  3. import org.eclipse.swt.widgets.*;
  4.  
  5. public class Sash_test {
  6.  
  7. public static void main (String [] args) {
  8.     Display display = new Display ();
  9.  
  10.     Shell shell = new Shell (display);
  11.     shell.setSize(400, 300);
  12.     shell.setBackground(shell.getDisplay().getSystemColor(SWT.COLOR_BLACK));
  13.     final Sash sash = new Sash (shell, SWT.BORDER | SWT.VERTICAL);
  14.     sash.setBackground(shell.getDisplay().getSystemColor(SWT.COLOR_GREEN));
  15.     Rectangle clientArea = shell.getClientArea ();
  16.     sash.setBounds (180, clientArea.y, 32, clientArea.height);
  17.     sash.addListener (SWT.Selection, new Listener () {
  18.         public void handleEvent (Event e) {
  19.             sash.setBounds (e.x, e.y, e.width, e.height);
  20.         }
  21.     });
  22.     shell.open ();
  23.     sash.setFocus ();
  24.     while (!shell.isDisposed ()) {
  25.         if (!display.readAndDispatch ()) display.sleep ();
  26.     }
  27.     display.dispose ();
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment