List of usage examples for org.eclipse.swt.widgets Display Display
public Display()
From source file:ToolBarVertical.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, 0); item.setText("Item " + i); }/* w w w . ja v a 2s .c om*/ bar.pack(); 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 d = new Display(); Shell s = new Shell(d); Menu m = new Menu(s, SWT.BAR); final MenuItem options = new MenuItem(m, SWT.CASCADE); options.setText("&Options"); final Menu optionsmenu = new Menu(s, SWT.DROP_DOWN); options.setMenu(optionsmenu);//from w ww . j a va 2s.co m final MenuItem checkItem = new MenuItem(optionsmenu, SWT.CHECK); checkItem.setText("&Checked Option"); final MenuItem optionsseparator = new MenuItem(optionsmenu, SWT.SEPARATOR); final MenuItem radioItem1 = new MenuItem(optionsmenu, SWT.RADIO); radioItem1.setText("Radio &One"); final MenuItem radioItem2 = new MenuItem(optionsmenu, SWT.RADIO); radioItem2.setText("Radio &Two"); s.setMenuBar(m); s.open(); while (!s.isDisposed()) { if (!d.readAndDispatch()) d.sleep(); } d.dispose(); }
From source file:PasswordFieldTextExample.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new GridLayout(1, false)); // Create a password text field new Text(shell, SWT.PASSWORD | SWT.BORDER); shell.open();/*w w w . j a v a 2 s . co m*/ while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:TableCheckBoxCell.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); Table table = new Table(shell, SWT.CHECK | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL); for (int i = 0; i < 12; i++) { TableItem item = new TableItem(table, SWT.NONE); item.setText("Item " + i); }/* ww w .j a va 2 s. c o m*/ table.setSize(100, 100); shell.setSize(200, 200); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:ToolItemCheckBox.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.CHECK); item.setText("Item " + i); }/* w ww . ja v a2s. c o m*/ bar.pack(); shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:ToolItemDropDown.java
License:asdf
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.DROP_DOWN); item.setText("asdf"); }//from ww w . ja v a2 s . co m bar.pack(); 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(); final Shell shell = new Shell(display); MessageBox mb = new MessageBox(shell, SWT.OK | SWT.CANCEL); mb.setText("Message from SWT"); mb.setMessage("message body"); int val = mb.open(); String valString = ""; switch (val) { case SWT.OK:// w w w . ja v a 2 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: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); mb.setText("Message from SWT"); mb.setMessage("message body"); int val = mb.open(); String valString = ""; switch (val) { case SWT.OK://w w w . j a va 2 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: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_WORKING); mb.setText("Message from SWT"); mb.setMessage("message body"); int val = mb.open(); String valString = ""; switch (val) { case SWT.OK:/*from w w w. ja v 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.ICON_INFORMATION); mb.setText("Message from SWT"); mb.setMessage("message body"); int val = mb.open(); String valString = ""; switch (val) { case SWT.OK:/*from ww w .ja v a2s . 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(); }