Examples of BalloonWindow


Examples of com.novocode.naf.swt.custom.BalloonWindow

        if (control != null) {
            parentShell = control.getShell();
            parentShell.forceActive();
        }

        final BalloonWindow window = new BalloonWindow(parentShell, SWT.ON_TOP
            | SWT.TOOL | SWT.CLOSE | SWT.TITLE);

        window.setText(title);

        // Adding the text to the contents. Pack() is required
        // so the size of the composite is recalculated, else
        // the contents won't show
        Composite c = window.getContents();
        c.setLayout(new FillLayout());
        Label l = new Label(c, SWT.NONE);
        l.setText(text);
        c.pack(true);

        // Locate the balloon to the widget location
        if (control != null) {
            Point widgetLocation = control.toDisplay(new Point(0, 0));
            window.setLocation(widgetLocation);
        }

        // Runnable that will close the window after time has been expired
        final Runnable closeWindow = Utils.wrapSafe(log, new Runnable() {

            public void run() {
                final Shell shell = window.getShell();
                if (shell.isDisposed())
                    return;
                shell.forceActive();
                window.close();
            }
        });
        window.getShell().getDisplay().timerExec(timeout, closeWindow);

        window.open();

    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.