List of usage examples for org.eclipse.swt.widgets Display readAndDispatch
public boolean readAndDispatch()
true
if there is potentially more work to do, or false
if the caller can sleep until another event is placed on the event queue. 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 ww w .j a v a 2 s .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 va2 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 ww . j av a 2s. c o m 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);//from ww w . j a va 2 s .c o m 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]);/* w ww . j a va2 s . c o m*/ } // Select the third item single.select(2); shell.open(); 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 . ja v a 2 s . 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"); }/*from w w w . jav a2 s . co m*/ }); shell.pack(); 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 va 2 s .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);/* w ww . ja v a 2 s .c o m*/ shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:WrapStyleLabel.java
public static void main(String[] args) { final Display display = new Display(); Shell shell = new Shell(display); String text = "This is a long long long long long long long text."; Label labelNoWrap = new Label(shell, SWT.BORDER); labelNoWrap.setText(text);/*from w w w . j a va 2 s .c o m*/ labelNoWrap.setBounds(10, 10, 100, 100); Label labelWrap = new Label(shell, SWT.WRAP | SWT.BORDER); labelWrap.setText(text); labelWrap.setBounds(120, 10, 100, 100); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } }