List of usage examples for org.eclipse.swt.widgets Display Display
public Display()
From source file:TextAppendLine.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); Text text = new Text(shell, SWT.BORDER | SWT.V_SCROLL); text.setBounds(10, 10, 100, 100);//from ww w. j ava 2 s .com for (int i = 0; i < 16; i++) { text.append("Line " + i + "\n"); } shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:FirstSWTClass.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setText("First SWT Application"); shell.setSize(250, 250);//from ww w . ja v a 2 s.c om Label label = new Label(shell, SWT.CENTER); label.setText("Greetings from SWT"); label.setBounds(shell.getClientArea()); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:NoLayoutSimple.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); Button button = new Button(shell, SWT.PUSH); button.setText("No layout"); button.setBounds(5, 5, 50, 150);/*from w w w . j a v a 2 s .c o m*/ shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:MainClass.java
public static void main(String[] a) { Display d = new Display(); Shell s = new Shell(d); s.setSize(250, 250);/*from ww w . ja va 2 s . c o m*/ s.setText("A ProgressBar Example"); final ProgressBar pb = new ProgressBar(s, SWT.HORIZONTAL); pb.setMinimum(0); pb.setMaximum(100); pb.setSelection(50); pb.setBounds(10, 10, 200, 20); s.open(); while (!s.isDisposed()) { if (!d.readAndDispatch()) d.sleep(); } d.dispose(); }
From source file:ShellOnTop.java
public static void main(String[] args) { final Display display = new Display(); final Shell shell = new Shell(display, SWT.ON_TOP); shell.setLayout(new FillLayout()); shell.open();/* w ww .j a v 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:BrowserLoadingWebsite.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); Browser browser = new Browser(shell, SWT.NONE); browser.setBounds(5, 5, 600, 600);/*from w w w. java 2 s .c o m*/ browser.setUrl("http://java2s.com"); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:SelectionStartEnd.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); Text text = new Text(shell, SWT.BORDER | SWT.V_SCROLL); text.setBounds(10, 10, 400, 100);/*from ww w. j a v a 2s . com*/ text.append("text text text text text text text text text text text text text "); shell.open(); text.setSelection(30, 38); System.out.println("selection=" + text.getSelection()); System.out.println("caret position=" + text.getCaretPosition()); System.out.println("caret location=" + text.getCaretLocation()); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:ShellToolWindow.java
public static void main(String[] args) { final Display display = new Display(); final Shell shell = new Shell(display, SWT.SHELL_TRIM | SWT.TOOL); shell.setLayout(new FillLayout()); shell.open();//from www. j av 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:ShellStates.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.setMinimized(true);//from w w w . jav a2 s . c o m shell.open(); // 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:MeasureString.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); GC gc = new GC(shell); Point size = gc.textExtent("Hellooooooooooooooooooooo"); System.out.println("Hello -> " + size); shell.pack();//w w w . j a v a 2 s .co m shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }