List of usage examples for org.eclipse.swt.widgets Display dispose
public void dispose()
From source file:LinkCreate.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); Link link = new Link(shell, SWT.BORDER); link.setText("This a very simple <A href=\"htpp://www.java2s.com\">link</A> widget."); link.setSize(140, 40);//ww w . j a v a2 s .com shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:TextAppendLine.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); Text text = new Text(shell, SWT.BORDER | SWT.V_SCROLL); text.setBounds(10, 10, 100, 100);// w ww . j a va 2s . c o m for (int i = 0; i < 16; i++) { text.append("Line " + i + "\n"); } shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:FormLayoutFormDataAttachment.java
public static void main(String[] args) { Display display = new Display(); final Shell shell = new Shell(display); shell.setLayout(new FormLayout()); Button button1 = new Button(shell, SWT.PUSH); button1.setText("button1"); shell.setSize(450, 400);//from w w w.ja v a2 s. com shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:ToolItemToolTip.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); ToolBar bar = new ToolBar(shell, SWT.BORDER); bar.setBounds(0, 20, 200, 64);// www .ja v a 2 s . co m ToolItem item1 = new ToolItem(bar, 0); item1.setToolTipText("ToolItem \n toolTip"); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:TabItemToolTip.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); TabFolder folder = new TabFolder(shell, SWT.BORDER); folder.setSize(200, 200);/*from ww w.java 2s. co m*/ TabItem item0 = new TabItem(folder, 0); item0.setToolTipText("TabItem \n toolTip"); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:Snippet50.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setText("Shell"); shell.setSize(200, 200);/*w w w.jav a2 s . c o m*/ shell.open(); Shell dialog = new Shell(shell); dialog.setText("Dialog"); dialog.setSize(200, 200); dialog.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:org.eclipse.swt.snippets.Snippet308.java
public static void main(String[] args) { final String html = "<html><title>Snippet</title><body><p id='myid'>Best Friends</p><p id='myid2'>Cat and Dog</p></body></html>"; Display display = new Display(); final Shell shell = new Shell(display); shell.setText("Snippet 308"); shell.setLayout(new FillLayout()); final Browser browser; try {/*from w w w. j a va 2 s .c o m*/ browser = new Browser(shell, SWT.NONE); } catch (SWTError e) { System.out.println("Could not instantiate Browser: " + e.getMessage()); display.dispose(); return; } browser.addProgressListener(ProgressListener.completedAdapter(event -> { String value = (String) browser .evaluate("return document.getElementById('myid').childNodes[0].nodeValue;"); System.out.println("Node value: " + value); })); /* Load an HTML document */ browser.setText(html); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:StyledTextWordWrap.java
public static void main(String[] args) { final Display display = new Display(); final Shell shell = new Shell(display); StyledText text1 = new StyledText(shell, SWT.V_SCROLL | SWT.BORDER); text1.setWordWrap(!text1.getWordWrap()); text1.setBounds(10, 10, 100, 100);//from ww w . jav a 2s . c o m shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:ShellWindowCloseEvent.java
public static void main(String[] args) { Display display = new Display(); final Shell shell = new Shell(display); shell.addListener(SWT.Close, new Listener() { public void handleEvent(Event event) { System.out.println("cose"); }//from www . 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:CursorImageCreate.java
public static void main(String[] args) { final Display display = new Display(); final Shell shell = new Shell(display); shell.setSize(150, 150);/*from w w w . ja va 2s. c o m*/ Cursor cursor = new Cursor(display, new Image(display, "yourFile.gif").getImageData(), 0, 0); shell.setCursor(cursor); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } cursor.dispose(); display.dispose(); }