List of usage examples for org.eclipse.swt.widgets Display Display
public Display()
From source file:MesssageBoxQuestionIconYESNOButton.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); MessageBox messageBox = new MessageBox(shell, SWT.ICON_QUESTION | SWT.YES | SWT.NO); messageBox.setMessage("Is this question simple?"); int rc = messageBox.open(); System.out.println(rc == SWT.YES); System.out.println(rc == SWT.NO); display.dispose();/*from w w w .jav a2s .c o m*/ }
From source file:StyledTextPrint.java
public static void main(String[] args) { final Display display = new Display(); final Shell shell = new Shell(display); StyledText styledText = new StyledText(shell, SWT.V_SCROLL | SWT.BORDER); styledText.setText("12345"); styledText.print();//from ww w . j a v a 2s . c om styledText.setBounds(10, 10, 100, 100); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:ShellTrimCloseTitleMinMax.java
public static void main(String[] args) { final Display display = new Display(); final Shell shell = new Shell(display, SWT.SHELL_TRIM); shell.setLayout(new FillLayout()); shell.open();/* w w w . j a v a2 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:MainClass.java
public static void main(String[] a) { Display display = new Display(); final Shell shell = new Shell(display); Region region = new Region(); region.add(createCircle(50, 50, 50)); region.subtract(createCircle(50, 50, 20)); shell.setRegion(region);/*ww w .j a v a 2 s . c om*/ shell.setSize(region.getBounds().width, region.getBounds().height); shell.setBackground(display.getSystemColor(SWT.COLOR_BLUE)); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:StyledTextReadOnly.java
public static void main(String[] args) { final Display display = new Display(); final Shell shell = new Shell(display); StyledText styledText = new StyledText(shell, SWT.V_SCROLL | SWT.BORDER); styledText.setText("12345"); styledText.setEditable(false);//from w ww . j a va 2s. c om styledText.setBounds(10, 10, 100, 100); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:StyledTextKeyBound.java
public static void main(String[] args) { final Display display = new Display(); final Shell shell = new Shell(display); StyledText styledText = new StyledText(shell, SWT.V_SCROLL | SWT.BORDER); styledText.setText("12345"); int zAction = styledText.getKeyBinding('z'); styledText.setBounds(10, 10, 100, 100); shell.open();/* w w w . ja va 2 s .c om*/ while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:FileDialogSaveDefaultFileName.java
public static void main(String[] args) { Display display = new Display(); final Shell shell = new Shell(display); FileDialog dlg = new FileDialog(shell, SWT.SAVE); dlg.setFileName("defaultName"); String fileName = dlg.open(); if (fileName != null) { System.out.println(fileName); }//from w w w.ja v a2s . c om display.dispose(); }
From source file:StyledTextActionBound.java
public static void main(String[] args) { final Display display = new Display(); final Shell shell = new Shell(display); StyledText styledText = new StyledText(shell, SWT.V_SCROLL | SWT.BORDER); styledText.setText("12345"); int altEAction = styledText.getKeyBinding('e' | SWT.ALT); styledText.setBounds(10, 10, 100, 100); shell.open();/*www . j a v a2s. c om*/ 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 . j a v a 2 s. c om 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(); }
From source file:ShellCenter.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setSize(200, 200);//from ww w.j av a2 s. c o m Monitor primary = display.getPrimaryMonitor(); Rectangle bounds = primary.getBounds(); Rectangle rect = shell.getBounds(); int x = bounds.x + (bounds.width - rect.width) / 2; int y = bounds.y + (bounds.height - rect.height) / 2; shell.setLocation(x, y); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }