Balloon () { final BalloonImpl result = new BalloonImpl( myContent, myBorder, myBorderInsets, myFill, myHideOnMouseOutside, myHideOnKeyOutside, myHideOnAction, myHideOnCloseClick, myShowCallout, myCloseButtonEnabled, myFadeoutTime, myHideOnFrameResize, myHideOnLinkClick, myClickHandler, myCloseOnClick, myAnimationCycle, myCalloutShift, myPositionChangeXShift, myPositionChangeYShift, myDialogMode, myTitle, myContentInsets, myShadow, mySmallVariant, myBlockClicks, myLayer, myRequestFocus, myPointerSize, myCornerToPointerDistance); result.setCornerRadius(myCornerRadius); result.setPointerShiftedToStart(myPointerShiftedToStart); if (myStorage != null && myAnchor != null) { List<Balloon> balloons = myStorage.get(myAnchor); if (balloons == null) { myStorage.put(myAnchor, balloons = new ArrayList<>()); Disposer.register(myAnchor, () -> { List<Balloon> toDispose = myStorage.remove(myAnchor); if (toDispose != null) { for (Balloon balloon : toDispose) { if (!balloon.isDisposed()) { Disposer.dispose(balloon); } } } }); } balloons.add(result); result.addListener(new JBPopupListener() { @Override public void onClosed(@NotNull LightweightWindowEvent event) { if (!result.isDisposed()) { Disposer.dispose(result); } } }); } return result; }