private void createToolTipDialogIfNeeded() {
        // Not need to create the dialog if there is not text to show
        if ((toolTipDialog == null) && (toolTipText != null) && !toolTipText.isEmpty()) {
            toolTipDialog = new ToolTipDialog(decorationPainter, anchorLinkWithToolTip);
            toolTipDialog.addMouseListener(toolTipVisibilityAdapter);
            toolTipDialog.addMouseMotionListener(toolTipVisibilityAdapter);
            toolTipDialog.addComponentListener(toolTipVisibilityAdapter);
        }

        // But if there is (already) a dialog, update it with the text
        if (toolTipDialog != null) {
            toolTipDialog.setText(toolTipText);
        }
    }
private void createToolTipDialogIfNeeded ( ) { if ( ( toolTipDialog == null ) && ( toolTipText != null ) && ! toolTipText . isEmpty ( ) ) { toolTipDialog = new ToolTipDialog ( decorationPainter , anchorLinkWithToolTip ) ; toolTipDialog . addMouseListener ( toolTipVisibilityAdapter ) ; toolTipDialog . addMouseMotionListener ( toolTipVisibilityAdapter ) ; toolTipDialog . addComponentListener ( toolTipVisibilityAdapter ) ; } if ( toolTipDialog != null ) { toolTipDialog . setText ( toolTipText ) ; } }
Creates the dialog showing the tooltip if it is not created yet.
<p>
We do this only here to make sure that we have a parent and to make sure that we actually have a window
ancestor.
<p>
If we create the dialog before having a window ancestor, it will have no owner (see {@link
ToolTipDialog#ToolTipDialog(JComponent, AnchorLink)} and that will result in having the tooltip behind the
other windows of the application.