Point pt = new Point (event.x, event.y); CTabItem item = getItem(pt); if (item != null) { String tooltip = item.getToolTipText(); if (tooltip != null) { Label label = (Label) (tip.getChildren() [0]); label.setText(tooltip); tip.pack(); pt.y += 16; pt = toDisplay(pt);  Display display = tip.getDisplay(); Rectangle rect = display.getBounds(); Point size = tip.getSize(); pt.x = Math.max (0, Math.min (pt.x, rect.width - size.x)); pt.y = Math.max (0, Math.min (pt.y, rect.height - size.y)); tip.setLocation(pt);  tip.setVisible(true); return; } }  tip.setVisible(false);
showToolTip = true; showToolTip(event.x, event.y);
private void onMouseHover(Event event) {	if (tip.isDisposed()) return;	Point pt = new Point (event.x, event.y);	CTabItem item = getItem(pt);	if (item != null) {		String tooltip = item.getToolTipText();		if (tooltip != null) {						Label label = (Label) (tip.getChildren() [0]);			label.setText(tooltip);			tip.pack();			pt.y += 16;			pt = toDisplay(pt);			/*			* Ensure that the tooltip is on the screen.			*/			Display display = tip.getDisplay();			Rectangle rect = display.getBounds();			Point size = tip.getSize();			pt.x = Math.max (0, Math.min (pt.x, rect.width - size.x));			pt.y = Math.max (0, Math.min (pt.y, rect.height - size.y));			tip.setLocation(pt);							tip.setVisible(true);			return;		}	}	tip.setVisible(false);}