void () { NonFocusableCheckBox checkBox = new NonFocusableCheckBox(RefactoringBundle.message("delegation.panel.delegate.via.overloading.method")); checkBox.addActionListener(e -> { myDelegate = checkBox.isSelected(); updateCurrentInfo(); }); JPanel content = new JPanel(new BorderLayout()); content.add(new JBLabel(RefactoringBundle.message("inplace.change.signature.preview.label")), BorderLayout.NORTH); content.add(myPreview.getComponent(), BorderLayout.CENTER); updateMethodSignature(myStableChange); content.add(checkBox, BorderLayout.SOUTH); final BalloonBuilder balloonBuilder = JBPopupFactory.getInstance().createDialogBalloonBuilder(content, null).setSmallVariant(true); myBalloon = balloonBuilder.createBalloon(); myEditor.getScrollingModel().scrollToCaret(ScrollType.MAKE_VISIBLE); myBalloon.show(new PositionTracker<>(myEditor.getContentComponent()) { @Override public RelativePoint recalculateLocation(@NotNull Balloon object) { int offset = myStableChange.getMethod().getTextOffset(); VisualPosition visualPosition = myEditor.offsetToVisualPosition(offset); Point point = myEditor.visualPositionToXY(new VisualPosition(visualPosition.line, visualPosition.column)); return new RelativePoint(myEditor.getContentComponent(), point); } }, Balloon.Position.above); Disposer.register(myBalloon, () -> { EditorFactory.getInstance().releaseEditor(myPreview); myPreview = null; }); }