List of usage examples for org.eclipse.swt.widgets Display sleep
public boolean sleep()
From source file:TextTextSelection.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new FillLayout()); final Text t = new Text(shell, SWT.BORDER | SWT.MULTI); t.setText("here is some text to be selected"); t.selectAll();/*from w w w. ja va2 s. c om*/ shell.setSize(200, 200); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:Main.java
public static void main(String[] arguments) { final Display display = new Display(); final Shell shell = new Shell(display); shell.setLayout(new FillLayout()); final FXCanvas canvas = new FXCanvas(shell, SWT.NONE); final Scene scene = TextIntegrationSceneCreator.createTextScene(); canvas.setScene(scene);//from w w w . j a va 2 s . c o m 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 shell = new Shell(d); shell.setSize(250, 200);/*from w w w .j av a 2 s. co m*/ shell.setLayout(new FillLayout()); Canvas drawingCanvas = new Canvas(shell, SWT.NONE); drawingCanvas.addPaintListener(new ArcExamplePaintListener()); shell.open(); while (!shell.isDisposed()) { if (!d.readAndDispatch()) d.sleep(); } d.dispose(); }
From source file:StyledTextLimit.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.setTextLimit(10);/*from w w w .ja v a 2 s .com*/ styledText.setBounds(10, 10, 100, 100); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:Draw2DTest.java
public static void main(String[] args) { final Graphics2DRenderer renderer = new Graphics2DRenderer(); Shell shell = new Shell(); shell.setSize(350, 350);/*ww w . ja v a 2 s . c o m*/ shell.open(); shell.setText("Draw2d Hello World"); LightweightSystem lws = new LightweightSystem(shell); IFigure figure = new Figure() { protected void paintClientArea(org.eclipse.draw2d.Graphics graphics) { Dimension controlSize = getSize(); renderer.prepareRendering(graphics); // prepares the Graphics2D renderer // gets the Graphics2D context and switch on the antialiasing Graphics2D g2d = renderer.getGraphics2D(); g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); // paints the background with a color gradient g2d.setPaint(new GradientPaint(0.0f, 0.0f, java.awt.Color.yellow, (float) controlSize.width, (float) controlSize.width, java.awt.Color.white)); g2d.fillRect(0, 0, controlSize.width, controlSize.width); // draws rotated text g2d.setFont(new java.awt.Font("SansSerif", java.awt.Font.BOLD, 16)); g2d.setColor(java.awt.Color.blue); g2d.translate(controlSize.width / 2, controlSize.width / 2); int nbOfSlices = 18; for (int i = 0; i < nbOfSlices; i++) { g2d.drawString("Angle = " + (i * 360 / nbOfSlices) + "\u00B0", 30, 0); g2d.rotate(-2 * Math.PI / nbOfSlices); } // now that we are done with Java2D, renders Graphics2D // operation // on the SWT graphics context renderer.render(graphics); // now we can continue with pure SWT paint operations graphics.drawOval(0, 0, controlSize.width, controlSize.width); } }; lws.setContents(figure); Display display = Display.getDefault(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } renderer.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;/* w ww . j ava 2 s. co m*/ 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:StyledTextReadOnly.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.setEditable(false);//from w ww . j a va 2s. c o m styledText.setBounds(10, 10, 100, 100); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:FormLayoutSimple.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); FormLayout layout = new FormLayout(); layout.marginHeight = 5;//w w w . j a v a2s . co m 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:GetPreferredSize.java
public static void main(String[] args) { final Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new GridLayout()); Button button = new Button(shell, SWT.PUSH | SWT.LEFT); button.setText("Button"); System.out.println("toControl: " + button.toControl(100, 200)); shell.open();//from w w w .ja v a 2 s .c o m while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } }
From source file:DisplayPositionRelative.java
public static void main(String[] args) { final Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new GridLayout()); Button button = new Button(shell, SWT.PUSH | SWT.LEFT); button.setText("Button"); System.out.println("toDisplay: " + button.toDisplay(100, 200)); shell.open();// w w w. j av a 2 s . c om while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } }