List of usage examples for org.eclipse.swt.widgets Display Display
public Display()
From source file:TableItemGetIndex.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 a va 2s .c om*/ 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 "); System.out.println(table.indexOf(item)); 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 ww w.j a v a2 s. c o 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: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 ww.ja v a 2 s. c o m shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:MessageBoxQuestionIconYESNOButton.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); int style = 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:/* w w w. ja va2 s . com*/ 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:ColorDialogSetInitColor.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); ColorDialog dlg = new ColorDialog(shell); dlg.setRGB(new RGB(0, 0, 255)); RGB rgb = dlg.open();// ww w .ja v a2s . c o m if (rgb != null) { Color color = new Color(shell.getDisplay(), rgb); System.out.println(color.getRGB()); color.dispose(); } 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); // create a file menu and add an exit item final MenuItem file = new MenuItem(m, SWT.CASCADE); file.setText("File"); final Menu filemenu = new Menu(s, SWT.DROP_DOWN); file.setMenu(filemenu);//from www . ja va 2 s. c o m // create an open menu and to sub-menu items final MenuItem openItem = new MenuItem(filemenu, SWT.CASCADE); openItem.setText("Open"); final Menu submenu = new Menu(s, SWT.DROP_DOWN); openItem.setMenu(submenu); final MenuItem childItem = new MenuItem(submenu, SWT.PUSH); childItem.setText("Child"); final MenuItem dialogItem = new MenuItem(submenu, SWT.PUSH); dialogItem.setText("Dialog"); // add a separator final MenuItem separator = new MenuItem(filemenu, SWT.SEPARATOR); // create an exit menu item final MenuItem exitItem = new MenuItem(filemenu, SWT.PUSH); exitItem.setText("Exit"); s.setMenuBar(m); s.open(); while (!s.isDisposed()) { if (!d.readAndDispatch()) d.sleep(); } d.dispose(); }
From source file:DisplayPositionRelative.java
public static void main(String[] args) { final Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new GridLayout()); Button button = new Button(shell, SWT.PUSH | SWT.LEFT); button.setText("Button"); System.out.println("toDisplay: " + button.toDisplay(100, 200)); shell.open();/* w w w . j av a 2 s. co m*/ while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } }
From source file:EscapeMnemonicCharacter.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();/* w w w .j a va2 s . co m*/ // 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:ColorDialogCreateGetColor.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); ColorDialog dlg = new ColorDialog(shell); RGB rgb = dlg.open();/* ww w.j a v a2 s . c o m*/ if (rgb != null) { Color color = new Color(shell.getDisplay(), rgb); System.out.println(color.getRGB()); color.dispose(); } display.dispose(); }
From source file:Main.java
public static void main(String[] arguments) { final Display display = new Display(); final Shell shell = new Shell(display); shell.setLayout(new FillLayout()); final FXCanvas canvas = new FXCanvas(shell, SWT.NONE); final Scene scene = TextIntegrationSceneCreator.createTextScene(); canvas.setScene(scene);//from www . j av a 2 s .c o m shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }