List of usage examples for org.eclipse.swt.widgets Display Display
public Display()
From source file:LabelWithText.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setSize(300, 200);//from w w w . j a va 2 s . c om Label label = new Label(shell, SWT.CENTER); label.setText("No worries!"); label.setBounds(shell.getClientArea()); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:FileSaveDialogFilterNameFilterExtensions.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); FileDialog dialog = new FileDialog(shell, SWT.SAVE); dialog.setFilterNames(new String[] { "Batch Files", "All Files (*.*)" }); dialog.setFilterExtensions(new String[] { "*.bat", "*.*" }); // Windows // wild cards dialog.setFilterPath("c:\\"); // Windows path dialog.setFileName("yourFile.bat"); System.out.println("Save to: " + dialog.open()); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep();//from www .jav a 2 s .c o m } 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) { System.out.println(printerData.printToFile); // Printer printer = new Printer(printerData); // Use printer . . . // printer.dispose(); }/*from w w w . ja v a 2 s.co m*/ while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:StyledTextClipboard.java
public static void main(String[] args) { final Display display = new Display(); final Shell shell = new Shell(display); StyledText text1 = new StyledText(shell, SWT.V_SCROLL | SWT.WRAP | SWT.BORDER); StyledText text2 = new StyledText(shell, SWT.V_SCROLL | SWT.WRAP | SWT.BORDER); text1.setText("1234567"); text1.setSelectionRange(2, 4);//w ww . j a va2s.c o m text1.cut(); text2.paste(); text1.setBounds(10, 10, 100, 100); text2.setBounds(10, 300, 100, 100); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:TableBackgroundTableItemForeground.java
public static void main(String[] args) { Display display = new Display(); Color red = display.getSystemColor(SWT.COLOR_RED); Color gray = display.getSystemColor(SWT.COLOR_GRAY); Shell shell = new Shell(display); shell.setLayout(new FillLayout()); Table table = new Table(shell, SWT.BORDER); table.setBackground(gray);/*from w w w .jav a 2 s. c om*/ TableColumn column1 = new TableColumn(table, SWT.NONE); TableColumn column2 = new TableColumn(table, SWT.NONE); TableColumn column3 = new TableColumn(table, SWT.NONE); TableItem item = new TableItem(table, SWT.NONE); item.setText(new String[] { "entire", "row", "red foreground" }); item.setForeground(red); column1.pack(); column2.pack(); column3.pack(); shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:TextPassword.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new FillLayout()); Text text = new Text(shell, SWT.SINGLE | SWT.BORDER); text.setEchoChar('*'); shell.pack();//from ww w . j a v a 2 s. com shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:MainClass.java
public static void main(String[] a) { final Display d = new Display(); final Shell s = new Shell(d); s.setSize(250, 200);//from w w w. ja v a2 s . co m s.setText("A MouseTrackListener Example"); s.open(); s.addMouseTrackListener(new MouseTrackAdapter() { public void mouseEnter(MouseEvent e) { System.out.println("enter"); } public void mouseExit(MouseEvent e) { System.out.println("exit"); } }); while (!s.isDisposed()) { if (!d.readAndDispatch()) d.sleep(); } d.dispose(); }
From source file:MainClass.java
public static void main(String[] a) { Display display = new Display(); Shell shell = new Shell(display); FormLayout layout = new FormLayout(); layout.marginHeight = 5;//from www .jav a 2s . c om layout.marginWidth = 10; shell.setLayout(layout); new Button(shell, SWT.PUSH).setText("Button"); shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:CaretImage.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.open();// w w w. j a v a2 s .c o m Caret caret = new Caret(shell, SWT.NONE); Image image = new Image(display, "yourFile.gif"); caret.setLocation(10, 10); caret.setImage(image); caret.setVisible(true); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:WidgetDisposeListener.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent e) { System.out.println(e.widget + " disposed"); }/*from ww w. j a va 2s. co m*/ }); shell.setSize(260, 120); shell.open(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } }