ToolItemToolTip.java Source code

Java tutorial

Introduction

Here is the source code for ToolItemToolTip.java

Source

import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.swt.widgets.ToolItem;

public class ToolItemToolTip {

    public static void main(String[] args) {

        Display display = new Display();
        Shell shell = new Shell(display);

        ToolBar bar = new ToolBar(shell, SWT.BORDER);
        bar.setBounds(0, 20, 200, 64);
        ToolItem item1 = new ToolItem(bar, 0);
        item1.setToolTipText("ToolItem \n toolTip");

        shell.open();
        while (!shell.isDisposed()) {
            if (!display.readAndDispatch())
                display.sleep();
        }
        display.dispose();
    }
}