void () { final JLayeredPane layeredPane = getLayeredPane(); final Dimension preferredTextFieldPanelSize = myTextFieldPanel.getPreferredSize(); final int x = (layeredPane.getWidth() - preferredTextFieldPanelSize.width) / 2; final int paneHeight = layeredPane.getHeight(); final int y = paneHeight / 3 - preferredTextFieldPanelSize.height / 2; ComponentPopupBuilder builder = JBPopupFactory.getInstance().createComponentPopupBuilder(myTextFieldPanel, myTextField); builder.setLocateWithinScreenBounds(false); builder.setKeyEventHandler(event -> { if (myTextPopup == null || !AbstractPopup.isCloseRequest(event) || !myTextPopup.isCancelKeyEnabled()) { return false; } IdeFocusManager focusManager = IdeFocusManager.getInstance(myProject); if (isDescendingFromTemporarilyFocusableToolWindow(focusManager.getFocusOwner())) { focusManager.requestFocus(myTextField, true); return false; } else { myTextPopup.cancel(event); return true; } }).setCancelCallback(() -> { myTextPopup = null; close(false); return Boolean.TRUE; }).setFocusable(true).setRequestFocus(true).setModalContext(false).setCancelOnClickOutside(false); Dimension size = new Dimension(preferredTextFieldPanelSize.width + 20, preferredTextFieldPanelSize.height); myTextPopup = builder.createPopup(); myTextPopup.setSize(size); if (myProject != null && !myProject.isDefault()) { DaemonCodeAnalyzer.getInstance(myProject).disableUpdateByTimer(myTextPopup); } Disposer.register(myTextPopup, () -> cancelListUpdater()); IdeEventQueue.getInstance().getPopupManager().closeAllPopups(false); RelativePoint location = new RelativePoint(layeredPane, new Point(x, y)); myTextPopup.show(location); }