Project: SWT
Bug 136451 ToolItem is not visible if bounds set before text
Reported: 2006-04-12 16:13:32 | Status: verified fixed

Run the following example. The toolbar does not appear. Change example to set the bounds after the text was set and toolitem is visible. public static void main (String [] args) { String string = "This is a string\nwith a new line."; Display display = new Display (); Shell shell = new Shell (display); ToolBar bar = new ToolBar (shell, SWT.BORDER); // setting bounds before text - toolitem is not displayed bar.setBounds (10, 220, 200, 100); ToolItem item1 = new ToolItem (bar, SWT.PUSH); item1.setText("tool item"); // setting bounds after text and toolitem appears //bar.setBounds (10, 220, 200, 100); item1.setToolTipText (string); shell.setToolTipText (string); shell.open (); while (!shell.isDisposed ()) { if (!display.readAndDispatch ()) display.sleep (); } display.dispose (); }

Files changed in fix:
bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/ToolItem.java