List of usage examples for org.eclipse.swt.widgets Display dispose
public void dispose()
From source file:MainClass.java
public static void main(String[] a) { final Display d = new Display(); final Shell s = new Shell(d); s.setSize(250, 200);//from www . j a v a2s . c om s.setText("A MouseTrackListener Example"); s.open(); s.addMouseTrackListener(new MouseTrackAdapter() { public void mouseEnter(MouseEvent e) { System.out.println("enter"); } public void mouseExit(MouseEvent e) { System.out.println("exit"); } }); while (!s.isDisposed()) { if (!d.readAndDispatch()) d.sleep(); } d.dispose(); }
From source file:DrawRoundRectangle.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); }//from w w w . ja v a 2 s . c om }); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:TableRowSelectionRemove.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); final Table table = new Table(shell, SWT.BORDER | SWT.MULTI); table.setSize(200, 200);/*from w ww.jav a 2 s .co m*/ for (int i = 0; i < 128; i++) { TableItem item = new TableItem(table, SWT.NONE); item.setText("Item " + i); } table.setSelection(2); table.remove(table.getSelectionIndices()); shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:GridLayoutColumnNumber2.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); GridLayout layout = new GridLayout(); layout.numColumns = 2;//from w ww. j a v a2 s .co m shell.setLayout(layout); new Button(shell, SWT.PUSH).setText("one"); new Button(shell, SWT.PUSH).setText("two"); new Button(shell, SWT.PUSH).setText("three"); new Button(shell, SWT.PUSH).setText("four"); shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:TreeItemInsert.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); Tree tree = new Tree(shell, SWT.BORDER | SWT.MULTI); tree.setSize(200, 200);//from w w w. j a va2s . co m for (int i = 0; i < 5; i++) { TreeItem item = new TreeItem(tree, SWT.NONE); item.setText("Item " + i); } TreeItem item = new TreeItem(tree, SWT.NONE, 1); item.setText("*** New Item ***"); shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:org.eclipse.swt.snippets.Snippet245.java
public static void main(String[] args) { final Display display = new Display(); final Shell shell = new Shell(display); shell.setText("Snippet 245"); shell.addPaintListener(event -> { Rectangle rect = shell.getClientArea(); event.gc.drawOval(0, 0, rect.width - 1, rect.height - 1); });/*from w w w . j av a 2 s . c o m*/ Rectangle clientArea = shell.getClientArea(); shell.setBounds(clientArea.x + 10, clientArea.y + 10, 200, 200); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:TableItemInsertByIndex.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); Table table = new Table(shell, SWT.BORDER | SWT.MULTI); table.setSize(200, 200);/*from w w w. j av a2 s .c o m*/ for (int i = 0; i < 12; i++) { TableItem item = new TableItem(table, SWT.NONE); item.setText("Item " + i); } TableItem item = new TableItem(table, SWT.NONE, 5); item.setText(" New Item "); shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:TextBold.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new FillLayout()); StyledText text = new StyledText(shell, SWT.BORDER); text.setText("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"); StyleRange style1 = new StyleRange(); style1.start = 0;/* w ww . jav a2s . com*/ style1.length = 10; style1.fontStyle = SWT.BOLD; text.setStyleRange(style1); 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) { final Display d = new Display(); final Shell shell = new Shell(d); shell.setSize(250, 200);//from w ww . ja va2 s . 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:ModifyListenerUsing.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("Type somthing to modify."); text.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent arg0) { System.out.println("Text modified"); }//from w ww. j ava2 s .c o m }); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }