void (final IdeTooltip tooltip, boolean animationEnabled) { boolean toCenterX; boolean toCenterY; boolean toCenter = tooltip.isToCenter(); boolean small = false; if (!toCenter && tooltip.isToCenterIfSmall()) { Dimension size = tooltip.getComponent().getSize(); toCenterX = size.width < 64; toCenterY = size.height < 64; toCenter = toCenterX || toCenterY; small = true; } else { toCenterX = true; toCenterY = true; } Point effectivePoint = tooltip.getPoint(); if (effectivePoint == null) { LOG.warn("No point specified for a tooltip for the component " + tooltip.getComponent()); effectivePoint = new Point(); toCenter = true; // Might as well just center it, since we're not given a point. } if (toCenter) { Rectangle bounds = tooltip.getComponent().getBounds(); effectivePoint.x = toCenterX ? bounds.width / 2 : effectivePoint.x; effectivePoint.y = toCenterY ? bounds.height / 2 : effectivePoint.y; } if (myCurrentComponent == tooltip.getComponent() && myBalloon != null && !myBalloon.isDisposed()) { myBalloon.show(new RelativePoint(tooltip.getComponent(), effectivePoint), tooltip.getPreferredPosition()); return; } if (myCurrentComponent == tooltip.getComponent() && effectivePoint.equals(new Point(myX, myY))) { return; } Color bg = tooltip.getTextBackground() != null ? tooltip.getTextBackground() : getTextBackground(true); Color fg = tooltip.getTextForeground() != null ? tooltip.getTextForeground() : getTextForeground(true); Color borderColor = tooltip.getBorderColor() != null ? tooltip.getBorderColor() : JBUI.CurrentTheme.Tooltip.borderColor(); BalloonBuilder builder = JBPopupFactory.getInstance().createBalloonBuilder(tooltip.getTipComponent()) .setFillColor(bg) .setBorderColor(borderColor) .setBorderInsets(tooltip.getBorderInsets()) .setAnimationCycle(animationEnabled ? RegistryManager.getInstance().intValue("ide.tooltip.animationCycle") : 0) .setShowCallout(true) .setPointerSize(tooltip.getPointerSize()) .setCalloutShift(small && tooltip.getCalloutShift() == 0 ? 2 : tooltip.getCalloutShift()) .setPositionChangeXShift(tooltip.getPositionChangeX()) .setPositionChangeYShift(tooltip.getPositionChangeY()) .setHideOnKeyOutside(!tooltip.isExplicitClose()) .setHideOnAction(!tooltip.isExplicitClose()) .setRequestFocus(tooltip.isRequestFocus()) .setLayer(tooltip.getLayer()); tooltip.getTipComponent().setForeground(fg); tooltip.getTipComponent().setBorder(tooltip.getComponentBorder()); tooltip.getTipComponent().setFont(tooltip.getFont() != null ? tooltip.getFont() : getTextFont(true)); if (tooltip.isPointerShiftedToStart()) { builder.setPointerShiftedToStart(true).setCornerRadius(JBUI.scale(8)); } myBalloon = builder.createBalloon(); myBalloon.setAnimationEnabled(animationEnabled); tooltip.setUi(myBalloon instanceof IdeTooltip.Ui ? (IdeTooltip.Ui)myBalloon : null); myCurrentComponent = tooltip.getComponent(); myX = effectivePoint.x; myY = effectivePoint.y; myCurrentTipIsCentered = toCenter; currentTooltip = tooltip; myShowRequest = null; myQueuedComponent = null; myQueuedTooltip = null; lastDisposable = myBalloon; Disposer.register(lastDisposable, new Disposable() { @Override public void dispose() { lastDisposable = null; } }); myBalloon.show(new RelativePoint(tooltip.getComponent(), effectivePoint), tooltip.getPreferredPosition()); myAlarm.addRequest(() -> { if (currentTooltip == tooltip && tooltip.canBeDismissedOnTimeout()) { hideCurrent(null, null, null); } }, tooltip.getDismissDelay()); }