List of usage examples for org.eclipse.swt.widgets Display dispose
public void dispose()
From source file:Snippet120.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setSize(200, 200);//from w w w. j av a2 s . com 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(); }
From source file:StyledTextPaint.java
public static void main(String[] args) { final Display display = new Display(); Shell shell = new Shell(display); shell.setBounds(10, 10, 250, 250);/*from w ww . j a va 2 s.co m*/ final StyledText text = new StyledText(shell, SWT.NONE); text.setBounds(10, 10, 200, 200); text.addListener(SWT.Paint, new Listener() { public void handleEvent(Event event) { System.out.println("paint"); } }); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:Snippet78.java
public static void main(String[] args) { Display display = new Display(); final Shell shell = new Shell(display); shell.setLayout(new FillLayout()); final Label label1 = new Label(shell, SWT.BORDER); label1.setText("TEXT"); final Label label2 = new Label(shell, SWT.BORDER); setDragDrop(label1);// ww w .j a v a2 s . c o m setDragDrop(label2); shell.setSize(200, 200); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } 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 a v a2 s.co 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(); }
From source file:BackgroundColorImageInherit.java
public static void main(String[] args) { final Display display = new Display(); final Shell shell = new Shell(display); shell.setLayout(new RowLayout(SWT.VERTICAL)); Color color = display.getSystemColor(SWT.COLOR_CYAN); Group group = new Group(shell, SWT.NONE); group.setText("SWT.INHERIT_NONE"); group.setBackground(color);/*from w w w .j a v a 2s. c o m*/ group.setBackgroundMode(SWT.INHERIT_NONE); shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:CLabelBackgroundImage.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()); CLabel label = new CLabel(shell, SWT.BORDER); label.setText("text on the label"); label.setBackground(new Image(display, "yourFile.gif")); shell.open();/*from w w w . jav a 2 s . c o 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:org.eclipse.swt.snippets.Snippet269.java
public static void main(String[] args) { final Display display = new Display(); Shell shell = new Shell(display); shell.setText("Snippet 269"); shell.setLayout(new FillLayout()); Combo combo = new Combo(shell, SWT.NONE); combo.add("item"); combo.select(0);// ww w .ja va 2 s. c om shell.pack(); shell.open(); int stringLength = combo.getText().length(); combo.setSelection(new Point(stringLength, stringLength)); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:ControlSizeSetting.java
public static void main(String[] args) { final Display display = new Display(); final Shell shell = new Shell(display); shell.setSize(150, 150);//w w w. j a v a2 s .c om final Cursor[] cursor = new Cursor[1]; Button button = new Button(shell, SWT.PUSH); button.setText("Change cursor"); Point size = button.computeSize(SWT.DEFAULT, SWT.DEFAULT); button.setSize(size); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } if (cursor[0] != null) cursor[0].dispose(); display.dispose(); }
From source file:FormLayoutFormDataWidthHeight.java
public static void main(String[] args) { Display display = new Display(); final Shell shell = new Shell(display); shell.setLayout(new FormLayout()); FormData formData = new FormData(); formData.width = 100;//from ww w. j a va 2 s . c om formData.height = 200; Button button1 = new Button(shell, SWT.PUSH); button1.setText("button1"); button1.setLayoutData(formData); shell.setSize(450, 400); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:StyledTextClearKeyBinding.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.setKeyBinding('i' | SWT.ALT, ST.TOGGLE_OVERWRITE); //clear//from www .jav a 2 s.c o m styledText.setKeyBinding('i' | SWT.ALT, SWT.NULL); styledText.setBounds(10, 10, 100, 100); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }