List of usage examples for org.eclipse.swt.widgets Display Display
public Display()
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 ww.ja va2 s . co m*/ while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:ProgressBarUpdateUIThread.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); ProgressBar bar = new ProgressBar(shell, SWT.SMOOTH); bar.setBounds(10, 10, 200, 32);/*from ww w . j a v a2s . co m*/ shell.open(); for (int i = 0; i <= bar.getMaximum(); i++) { try { Thread.sleep(100); } catch (Throwable th) { } bar.setSelection(i); } while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:StyledTextReplaceTextRange.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("12345"); styledText.replaceTextRange(2, 3, "A"); styledText.setBounds(10, 10, 100, 100); shell.open();//from ww w . j ava 2 s. com while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:FileDialogFileTypeExtensions.java
public static void main(String[] args) { Display display = new Display(); final Shell shell = new Shell(display); FileDialog dlg = new FileDialog(shell, SWT.OPEN); dlg.setFilterNames(new String[] { "OpenOffice.org Spreadsheet Files (*.sxc)", "Microsoft Excel Spreadsheet Files (*.xls)", "Comma Separated Values Files (*.csv)", "All Files (*.*)" }); dlg.setFilterExtensions(new String[] { "*.sxc", "*.xls", "*.csv", "*.*" }); String fileName = dlg.open(); if (fileName != null) { System.out.println(fileName); }/*from w ww.java 2 s.c o m*/ display.dispose(); }
From source file:FileDialogStartingDirectoryFileName.java
public static void main(String[] args) { Display display = new Display(); final Shell shell = new Shell(display); FileDialog dlg = new FileDialog(shell, SWT.OPEN); dlg.setFilterPath("C:/"); String fileName = dlg.open(); if (fileName != null) { System.out.println(fileName); }// w ww. ja va2 s . co m display.dispose(); }
From source file:ImagePaint.java
public static void main(String[] args) { Display display = new Display(); Image image = new Image(display, 20, 20); Color black = display.getSystemColor(SWT.COLOR_BLACK); GC gc = new GC(image); gc.setForeground(black);/*from w ww. j a v a 2s. c om*/ gc.drawString("Test", 2, 2); gc.dispose(); display.dispose(); }
From source file:StyledTextStatistics.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"); System.out.println("Caret Offset: " + styledText.getCaretOffset()); System.out.println("Total Lines of Text: " + styledText.getLineCount()); System.out.println("Total Characters: " + styledText.getCharCount()); System.out.println("Current Line: " + (styledText.getLineAtOffset(styledText.getCaretOffset()) + 1)); styledText.setBounds(10, 10, 100, 100); shell.open();/*from ww w . j av a 2 s . c om*/ while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:MainButton.java
public static void main(String[] args) { final Display display = new Display(); Shell shell = new Shell(display); shell.setText("Radio Buttons"); shell.pack();//from w w w . jav a2 s . c o m Button[] radios = new Button[3]; radios[0] = new Button(shell, SWT.RADIO); radios[0].setSelection(true); radios[0].setText("Choice 1"); radios[0].setBounds(10, 5, 75, 30); radios[1] = new Button(shell, SWT.RADIO); radios[1].setText("Choice 2"); radios[1].setBounds(10, 30, 75, 30); radios[2] = new Button(shell, SWT.RADIO); radios[2].setText("Choice 3"); radios[2].setBounds(10, 55, 75, 30); shell.open(); shell.pack(); 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(); }/* w ww . ja va2 s. c o m*/ while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:StyledTextActionBoundArrowShift.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 shiftLeftAction = styledText.getKeyBinding(SWT.ARROW_LEFT | SWT.SHIFT); styledText.setBounds(10, 10, 100, 100); shell.open();//w ww . j a v a 2 s. c o m while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }