List of usage examples for org.eclipse.swt.widgets Display dispose
public void dispose()
From source file:DrawLine.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.open();//from w w w . j a va2 s. c o m GC gc = new GC(shell); gc.drawLine(0, 0, 19, 19); gc.drawLine(19, 0, 0, 19); gc.dispose(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:MainClass.java
public static void main(String[] a) { Display d = new Display(); Shell s = new Shell(d); s.setSize(250, 250);/*from www. ja v a 2s . co m*/ s.setText("A Text Example"); Text text1 = new Text(s, SWT.MULTI | SWT.BORDER); text1.setBounds(0, 0, 250, 250); s.open(); while (!s.isDisposed()) { if (!d.readAndDispatch()) d.sleep(); } d.dispose(); }
From source file:HTMLRendererInMemory.java
public static void main(String[] args) { String html = "<HTML><HEAD><TITLE>HTML Test</TITLE></HEAD><BODY>"; for (int i = 0; i < 100; i++) { html += "<a href=\"http://www.java2s.com\">java2s.com</a><br><br>"; }// ww w .ja v a 2 s . com html += "</BODY></HTML>"; Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new FillLayout()); Browser browser = new Browser(shell, SWT.NONE); browser.setText(html); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:MainClass.java
public static void main(String[] a) { Display d = new Display(); Shell s = new Shell(d); s.setSize(250, 250);//from w w w . j a va 2 s . c o m s.setText("A Text Example"); final Text text1 = new Text(s, SWT.SINGLE | SWT.BORDER); text1.setBounds(10, 10, 100, 20); s.open(); while (!s.isDisposed()) { if (!d.readAndDispatch()) d.sleep(); } d.dispose(); }
From source file:org.eclipse.swt.snippets.Snippet74.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setText("Snippet 74"); Caret caret = new Caret(shell, SWT.NONE); caret.setBounds(10, 10, 2, 32);//from w ww . j av a 2 s . c om shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:SeparatorLabelExample.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(); shell.setLayout(new GridLayout(1, false)); // Create a vertical separator new Label(shell, SWT.SEPARATOR); shell.open();//from ww w .ja v a 2 s . c o m while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:SWTFirst.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setText("Hello, world!"); shell.open();//from www. j a v a 2s . c om // Set up the event loop. while (!shell.isDisposed()) { if (!display.readAndDispatch()) { // If no more entries in the event queue display.sleep(); } } display.dispose(); }
From source file:BrowserLoadingWebsite.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); Browser browser = new Browser(shell, SWT.NONE); browser.setBounds(5, 5, 600, 600);//from ww w. j a va2 s .c o m browser.setUrl("http://java2s.com"); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:SingleLinefieldTextExample.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new GridLayout(1, false)); // Create a single-line text field new Text(shell, SWT.BORDER); shell.open();/*from w w w . j av a2 s. c o m*/ while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:org.eclipse.swt.snippets.Snippet132.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setText("Snippet 132"); shell.open();/* ww w . ja va2s . c o m*/ PrinterData data = Printer.getDefaultPrinterData(); if (data == null) { System.out.println("Warning: No default printer."); display.dispose(); return; } Printer printer = new Printer(data); if (printer.startJob("SWT Printing Snippet")) { Color black = printer.getSystemColor(SWT.COLOR_BLACK); Color white = printer.getSystemColor(SWT.COLOR_WHITE); Color red = printer.getSystemColor(SWT.COLOR_RED); Rectangle trim = printer.computeTrim(0, 0, 0, 0); Point dpi = printer.getDPI(); int leftMargin = dpi.x + trim.x; // one inch from left side of paper if (leftMargin < 0) leftMargin = -trim.x; // make sure to print on the printable area int topMargin = dpi.y / 2 + trim.y; // one-half inch from top edge of paper if (topMargin < 0) topMargin = -trim.y; // make sure to print on the printable area GC gc = new GC(printer); if (printer.startPage()) { gc.setBackground(white); gc.setForeground(black); String testString = "Hello World!"; Point extent = gc.stringExtent(testString); gc.drawString(testString, leftMargin, topMargin); gc.setForeground(red); gc.drawRectangle(leftMargin, topMargin, extent.x, extent.y); printer.endPage(); } gc.dispose(); printer.endJob(); } printer.dispose(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }