List of usage examples for org.eclipse.swt.widgets Display dispose
public void dispose()
From source file:CreateSingleSelectionListAddItems.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new FillLayout()); // Create a single-selection list List single = new List(shell, SWT.BORDER | SWT.SINGLE | SWT.V_SCROLL); // Add the items, one by one for (int i = 0, n = ITEMS.length; i < n; i++) { single.add(ITEMS[i]);/* w w w. jav a2s .c om*/ } shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:MainClass.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); PrintDialog dlg = new PrintDialog(shell); PrinterData printerData = dlg.open(); if (printerData != null) { System.out.println(printerData.printToFile); // Printer printer = new Printer(printerData); // Use printer . . . // printer.dispose(); }/*from w w w . jav a 2 s.c om*/ while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:TrackerMouseDown.java
public static void main(String[] args) { Display display = new Display(); final Shell shell = new Shell(display); shell.open();/*from w ww. ja v a2 s . c o m*/ shell.addListener(SWT.MouseDown, new Listener() { public void handleEvent(Event e) { Tracker tracker = new Tracker(shell, SWT.NONE); tracker.setRectangles(new Rectangle[] { new Rectangle(e.x, e.y, 100, 100), }); tracker.open(); } }); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:ImageRegistryUsing.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(); shell.setLayout(new GridLayout(1, false)); ImageRegistry ir = new ImageRegistry(); ir.put("image1", new Image(display, "yourFile.gif")); Button executeButton = new Button(shell, SWT.PUSH); executeButton.setText("Execute"); executeButton.setImage(ir.get("image1")); shell.open();/*w ww. j av a 2s . c om*/ while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:StyledTextLineBackground.java
public static void main(String[] args) { final Display display = new Display(); final Shell shell = new Shell(display); final StyledText styledText = new StyledText(shell, SWT.V_SCROLL | SWT.BORDER); styledText.setText("\n1234\n124\n\1234\n12314\n\1241234\n"); styledText.setLineBackground(0, 6, Display.getCurrent().getSystemColor(SWT.COLOR_BLUE)); styledText.setBounds(10, 10, 500, 100); shell.open();//from w w w .ja va2s . c o m while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:WidgetBoundsSetting.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setBounds(10, 10, 200, 200);/*w ww . jav a 2 s . c om*/ Button button1 = new Button(shell, SWT.PUSH); button1.setText("&Typical button"); button1.setBounds(10, 10, 180, 30); Button button2 = new Button(shell, SWT.PUSH); button2.setText("&Overidden button"); button2.setBounds(10, 50, 180, 30); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:ToolItemImage.java
public static void main(String[] args) { Display display = new Display(); Image image = new Image(display, "yourFile.gif"); Shell shell = new Shell(display); ToolBar toolBar = new ToolBar(shell, SWT.FLAT | SWT.BORDER); for (int i = 0; i < 12; i++) { ToolItem item = new ToolItem(toolBar, SWT.DROP_DOWN); item.setImage(image);/*from w w w .j av a2 s . c om*/ } toolBar.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } image.dispose(); display.dispose(); }
From source file:MainClass.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); PrintDialog dlg = new PrintDialog(shell); dlg.setScope(PrinterData.SELECTION); PrinterData printerData = dlg.open(); if (printerData != null) { Printer printer = new Printer(printerData); System.out.println(printer.getClientArea()); printer.dispose();/*from w w w . j a va 2s.c o m*/ } while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:CLabelWithTextImage.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.setImage(new Image(display, "yourFile.gif")); shell.open();/*from w w w .ja v a 2s . 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:FormLayoutAttachControl.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.left = new FormAttachment(50); Button button1 = new Button(shell, SWT.PUSH); button1.setText("button1"); button1.setLayoutData(formData);//from w w w .jav a 2 s . co m shell.setSize(450, 400); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }