Add ToolTip to ToolItem : ToolTip « SWT « Java Tutorial






Add ToolTip to ToolItem
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();
  }
}








17.73.ToolTip
17.73.1.Add ToolTip to Shell Window
17.73.2.Add ToolTip to ToolItemAdd ToolTip to ToolItem
17.73.3.Add ToolTip to TabItem
17.73.4.Create fake tool tips for items in a tableCreate fake tool tips for items in a table
17.73.5.Show a tool tip inside a rectangleShow a tool tip inside a rectangle