void (final @NotNull JComponent component, @NotNull RelativePoint p, int flags, int timeout, @Nullable Runnable onHintHidden) { EDT.assertIsEdt(); myHideAlarm.cancelAllRequests(); hideHints(HintManager.HIDE_BY_OTHER_HINT, false, false); ComponentPopupBuilder builder = JBPopupFactory.getInstance().createComponentPopupBuilder(component, null) .setRequestFocus(false) .setResizable(false) .setMovable(false); if(onHintHidden != null) builder.setCancelCallback(()->{ onHintHidden.run(); return true; }); final JBPopup popup = builder.createPopup(); popup.show(p); ListenerUtil.addMouseListener(component, new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { myHideAlarm.cancelAllRequests(); } }); ListenerUtil.addFocusListener(component, new FocusAdapter() { @Override public void focusGained(FocusEvent e) { myHideAlarm.cancelAllRequests(); } }); final HintManagerImpl.HintInfo info = new HintManagerImpl.HintInfo(new LightweightHint(component) { @Override public void hide() { popup.cancel(); } }, flags, false); myHintsStack.add(info); if (timeout > 0) { Timer timer = TimerUtil.createNamedTimer("Popup timeout", timeout, event -> Disposer.dispose(popup)); timer.setRepeats(false); timer.start(); } }