void (AnActionEvent e, JPanel result, JBPopup popup, InputEvent inputEvent) { if (inputEvent instanceof MouseEvent inputEvent1) { int width = result.getPreferredSize().width; Point point1 = new Point(inputEvent1.getX() - width / 2, inputEvent1.getY()); RelativePoint point = new RelativePoint(inputEvent1.getComponent(), point1); popup.show(point); } else { popup.showInBestPositionFor(e.getDataContext()); } }