List of usage examples for org.eclipse.swt.widgets Display Display
public Display()
From source file:MainClass.java
public static void main(String[] a) { Display display = new Display(); final Shell shell = new Shell(display); MessageBox mb = new MessageBox(shell, SWT.ICON_WARNING); mb.setText("Message from SWT"); mb.setMessage("message body"); int val = mb.open(); String valString = ""; switch (val) { case SWT.OK:/*from w ww .jav a 2s.c o m*/ valString = "SWT.OK"; break; case SWT.CANCEL: valString = "SWT.CANCEL"; break; case SWT.YES: valString = "SWT.YES"; break; case SWT.NO: valString = "SWT.NO"; break; case SWT.RETRY: valString = "SWT.RETRY"; break; case SWT.ABORT: valString = "SWT.ABORT"; break; case SWT.IGNORE: valString = "SWT.IGNORE"; break; } System.out.println(valString); shell.close(); 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(); final Shell shell = new Shell(display); MessageBox mb = new MessageBox(shell, SWT.YES | SWT.NO | SWT.CANCEL); mb.setText("Message from SWT"); mb.setMessage("message body"); int val = mb.open(); String valString = ""; switch (val) { case SWT.OK://from w ww. j av a 2 s . c om valString = "SWT.OK"; break; case SWT.CANCEL: valString = "SWT.CANCEL"; break; case SWT.YES: valString = "SWT.YES"; break; case SWT.NO: valString = "SWT.NO"; break; case SWT.RETRY: valString = "SWT.RETRY"; break; case SWT.ABORT: valString = "SWT.ABORT"; break; case SWT.IGNORE: valString = "SWT.IGNORE"; break; } System.out.println(valString); shell.close(); 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(); final Shell shell = new Shell(display); MessageBox mb = new MessageBox(shell, SWT.RETRY | SWT.CANCEL); mb.setText("Message from SWT"); mb.setMessage("message body"); int val = mb.open(); String valString = ""; switch (val) { case SWT.OK://from w w w. j av a 2 s. com valString = "SWT.OK"; break; case SWT.CANCEL: valString = "SWT.CANCEL"; break; case SWT.YES: valString = "SWT.YES"; break; case SWT.NO: valString = "SWT.NO"; break; case SWT.RETRY: valString = "SWT.RETRY"; break; case SWT.ABORT: valString = "SWT.ABORT"; break; case SWT.IGNORE: valString = "SWT.IGNORE"; break; } System.out.println(valString); shell.close(); 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(); final Shell shell = new Shell(display); MessageBox mb = new MessageBox(shell, SWT.OK); mb.setText("Message from SWT"); mb.setMessage("message body"); int val = mb.open(); String valString = ""; switch (val) { case SWT.OK:/*from www . j a v a2 s . c o m*/ valString = "SWT.OK"; break; case SWT.CANCEL: valString = "SWT.CANCEL"; break; case SWT.YES: valString = "SWT.YES"; break; case SWT.NO: valString = "SWT.NO"; break; case SWT.RETRY: valString = "SWT.RETRY"; break; case SWT.ABORT: valString = "SWT.ABORT"; break; case SWT.IGNORE: valString = "SWT.IGNORE"; break; } System.out.println(valString); shell.close(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:ButtonBasics.java
public static void main(String[] args) { final Display display = new Display(); final Shell shell = new Shell(display, SWT.SHELL_TRIM); shell.setLayout(new RowLayout()); Button button = new Button(shell, SWT.RIGHT); button.setText("text on the button"); shell.open();/*from w ww .j av a 2 s. c om*/ // Set up the event loop. while (!shell.isDisposed()) { if (!display.readAndDispatch()) { // If no more entries in event queue 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);/* w w w . java 2 s .c o 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:ToolItemButtonPush.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); ToolBar bar = new ToolBar(shell, SWT.BORDER | SWT.VERTICAL); for (int i = 0; i < 4; i++) { ToolItem item = new ToolItem(bar, SWT.PUSH); item.setText("Item " + i); }/*from w w w . ja v a 2 s . co m*/ bar.pack(); shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:MessageBoxErrorIcon.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); int style = SWT.ICON_ERROR; //SWT.ICON_QUESTION | SWT.YES | SWT.NO MessageBox messageBox = new MessageBox(shell, style); messageBox.setMessage("Message"); int rc = messageBox.open(); switch (rc) { case SWT.OK:/*from w ww. j a v a2 s. c o m*/ System.out.println("SWT.OK"); break; case SWT.CANCEL: System.out.println("SWT.CANCEL"); break; case SWT.YES: System.out.println("SWT.YES"); break; case SWT.NO: System.out.println("SWT.NO"); break; case SWT.RETRY: System.out.println("SWT.RETRY"); break; case SWT.ABORT: System.out.println("SWT.ABORT"); break; case SWT.IGNORE: System.out.println("SWT.IGNORE"); break; } display.dispose(); }
From source file:LabelWithBorder.java
public static void main(String[] args) { final Display display = new Display(); final Shell shell = new Shell(display, SWT.SHELL_TRIM); shell.setLayout(new RowLayout()); Label label = new Label(shell, SWT.BORDER); label.setText("text on the label"); shell.open();//from w ww . j a va2 s . c om // Set up the event loop. while (!shell.isDisposed()) { if (!display.readAndDispatch()) { // If no more entries in event queue display.sleep(); } } display.dispose(); }
From source file:SeparatorHorizontalVertical.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new FillLayout()); new Label(shell, SWT.SEPARATOR | SWT.HORIZONTAL); new Label(shell, SWT.SEPARATOR | SWT.VERTICAL); shell.setSize(200, 200);// w w w . j av a2 s . c o m shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }