List of usage examples for org.eclipse.swt.widgets Display sleep
public boolean sleep()
From source file:MainClass.java
public static void main(String[] a) { final Display d = new Display(); final Shell shell = new Shell(d); shell.setSize(250, 200);//from w ww . j a v a 2s. c o m shell.setLayout(new FillLayout()); // Create a canvas Canvas canvas = new Canvas(shell, SWT.NONE); canvas.addPaintListener(new PaintListener() { public void paintControl(PaintEvent e) { e.gc.drawRoundRectangle(10, 10, 200, 200, 30, 60); } }); shell.open(); while (!shell.isDisposed()) { if (!d.readAndDispatch()) d.sleep(); } d.dispose(); }
From source file:MainClass.java
public static void main(String[] a) { Display display = new Display(); Shell shell = new Shell(display); shell.setText("Sash One"); // The SWT.BORDER style Decorations d = new Decorations(shell, SWT.TITLE); d.setLayoutData(new GridData(GridData.FILL_BOTH)); d.setLayout(new FillLayout()); Label l = new Label(d, SWT.CENTER); l.setText("SWT.TITLE"); d.setBounds(20, 20, 100, 100);/*from w ww . j a va 2s. c o m*/ shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:MainClass.java
public static void main(String[] a) { Display display = new Display(); Shell shell = new Shell(display); shell.setText("Sash One"); // The SWT.BORDER style Decorations d = new Decorations(shell, SWT.CLOSE); d.setLayoutData(new GridData(GridData.FILL_BOTH)); d.setLayout(new FillLayout()); Label l = new Label(d, SWT.CENTER); l.setText("SWT.CLOSE"); d.setBounds(20, 20, 100, 100);/* ww w .j a v a2 s . c o m*/ shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:SashFormCreate.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setText("SashForm Test"); // Fill the parent window with the buttons and sash shell.setLayout(new FillLayout()); // Create the SashForm and the buttons SashForm sashForm = new SashForm(shell, SWT.HORIZONTAL); new Button(sashForm, SWT.PUSH).setText("Left"); new Button(sashForm, SWT.PUSH).setText("Right"); shell.open();/*w w w . j a v a2s . c o m*/ while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:SashSelectionListener.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); final Sash sash = new Sash(shell, SWT.BORDER | SWT.VERTICAL); sash.setBounds(10, 10, 32, 100);/* w w w.j a v a2s . c o m*/ sash.addListener(SWT.Selection, new Listener() { public void handleEvent(Event e) { System.out.println("selection"); sash.setBounds(e.x, e.y, e.width, e.height); } }); shell.open(); sash.setFocus(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:TextSelectionListener.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new RowLayout()); Text text = new Text(shell, SWT.SINGLE | SWT.BORDER); text.setText("some text"); text.addListener(SWT.DefaultSelection, new Listener() { public void handleEvent(Event e) { System.out.println(e.widget + " - Default Selection"); }// w ww . jav a 2 s . com }); shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:MainClass.java
public static void main(String[] a) { Display display = new Display(); Shell shell = new Shell(display); shell.setText("Sash One"); // The SWT.BORDER style Decorations d = new Decorations(shell, SWT.ON_TOP); d.setLayoutData(new GridData(GridData.FILL_BOTH)); d.setLayout(new FillLayout()); Label l = new Label(d, SWT.CENTER); l.setText("SWT.ON_TOP"); d.setBounds(20, 20, 100, 100);/* w w w . j a va 2s.c om*/ shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:ListItemSelection.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new FillLayout()); // Create a single-selection list List single = new List(shell, SWT.BORDER | SWT.SINGLE | SWT.V_SCROLL); // Add the items, one by one for (int i = 0, n = ITEMS.length; i < n; i++) { single.add(ITEMS[i]);//from w w w.j a v a 2 s .co m } // Select the third item single.select(2); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:CanvasRepaint.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setText("Canvas Example"); shell.setLayout(new FillLayout()); Canvas canvas = new Canvas(shell, SWT.NONE); canvas.addPaintListener(new PaintListener() { public void paintControl(PaintEvent e) { e.gc.drawRoundRectangle(10, 10, 200, 200, 30, 30); }/* w w w . j a v a 2s .c o m*/ }); canvas.redraw(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:MainClass.java
public static void main(String[] a) { Display display = new Display(); Shell shell = new Shell(display); shell.setText("Sash One"); // The SWT.BORDER style Decorations d = new Decorations(shell, SWT.NO_TRIM); d.setLayoutData(new GridData(GridData.FILL_BOTH)); d.setLayout(new FillLayout()); Label l = new Label(d, SWT.CENTER); l.setText("SWT.NO_TRIM"); d.setBounds(20, 20, 100, 100);//from w w w .j av a 2s. c om shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }