Example usage for javax.swing JToolTip getTipText

List of usage examples for javax.swing JToolTip getTipText

Introduction

In this page you can find the example usage for javax.swing JToolTip getTipText.

Prototype

public String getTipText() 

Source Link

Document

Returns the text that is shown when the tool tip is displayed.

Usage

From source file:com.haulmont.cuba.desktop.sys.DesktopToolTipManager.java

protected void showTooltip(JComponent field, String text) {
    if (!field.isShowing())
        return;//from  w  w w. j a va2  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);
    }
}

From source file:org.underworldlabs.swing.plaf.base.AcceleratorToolTipUI.java

private String getTipText(JToolTip tip) {

    String text = tip.getTipText();
    if (text == null) {

        text = Constants.EMPTY;//from   w  w w .j  a  v  a2s . co m
    }

    return text;
}