List of usage examples for javax.swing JToolTip addMouseListener
public synchronized void addMouseListener(MouseListener l)
From source file:com.haulmont.cuba.desktop.sys.DesktopToolTipManager.java
protected void showTooltip(JComponent field, String text) { if (!field.isShowing()) return;//www . j a va 2 s.c o m if (StringUtils.isEmpty(text)) { return; } PointerInfo pointerInfo = MouseInfo.getPointerInfo(); if (pointerInfo == null) { return; } if (toolTipWindow != null) { hideTooltip(); } component = field; final JToolTip toolTip = new CubaToolTip(); toolTip.setTipText(text); // Location to display tooltip Point location = getToolTipLocation(pointerInfo, toolTip.getTipText()); final Popup tooltipContainer = PopupFactory.getSharedInstance().getPopup(field, toolTip, location.x, location.y); tooltipContainer.show(); window = tooltipContainer; toolTipWindow = toolTip; tooltipShowing = true; if (!(field instanceof ToolTipButton)) { toolTip.addMouseListener(this); field.addMouseListener(this); } }