Search in sources :

Example 96 with PaintEvent

use of org.eclipse.swt.events.PaintEvent in project BiglyBT by BiglySoftware.

the class SWTBGImagePainter method main.

public static void main(String[] args) {
    Display display = Display.getDefault();
    Shell shell = new Shell(display, SWT.DIALOG_TRIM);
    shell.setLayout(new FillLayout());
    Composite c = new Composite(shell, SWT.BORDER);
    c.setLayout(new FillLayout());
    c.addPaintListener(new PaintListener() {

        @Override
        public void paintControl(PaintEvent e) {
            e.gc.drawLine(0, 0, 100, 50);
        }
    });
    Label lbl = new Label(c, SWT.NONE);
    lbl.setText("text");
    shell.open();
    while (!shell.isDisposed()) {
        if (display.readAndDispatch()) {
            display.sleep();
        }
    }
}
Also used : PaintEvent(org.eclipse.swt.events.PaintEvent) PaintListener(org.eclipse.swt.events.PaintListener) FillLayout(org.eclipse.swt.layout.FillLayout)

Aggregations

PaintEvent (org.eclipse.swt.events.PaintEvent)96 PaintListener (org.eclipse.swt.events.PaintListener)92 Canvas (org.eclipse.swt.widgets.Canvas)32 Composite (org.eclipse.swt.widgets.Composite)31 Rectangle (org.eclipse.swt.graphics.Rectangle)29 MouseEvent (org.eclipse.swt.events.MouseEvent)27 GridData (org.eclipse.swt.layout.GridData)26 Point (org.eclipse.swt.graphics.Point)24 GridLayout (org.eclipse.swt.layout.GridLayout)23 DisposeEvent (org.eclipse.swt.events.DisposeEvent)18 SelectionEvent (org.eclipse.swt.events.SelectionEvent)18 DisposeListener (org.eclipse.swt.events.DisposeListener)15 FillLayout (org.eclipse.swt.layout.FillLayout)15 Event (org.eclipse.swt.widgets.Event)15 MouseAdapter (org.eclipse.swt.events.MouseAdapter)14 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)13 ControlEvent (org.eclipse.swt.events.ControlEvent)12 Control (org.eclipse.swt.widgets.Control)12 GC (org.eclipse.swt.graphics.GC)11 Listener (org.eclipse.swt.widgets.Listener)11