static AutoCloseable tempGlobalPopupMenu(IVF2 fillMenu, double delay default 0.1) { ret fillMenu == null ?: tempAddPopupButtonListener(evt -> { awtLater(delay, r { var menu = currentPopupMenu(); new PopupMenuMaker maker; var c = evt.getComponent(); var c2 = SwingUtilities.getDeepestComponentAt(c, evt.getX(), evt.getY()); maker.ptInComponent(translateLocationBetweenComponents(ptInComponentFromEvent(evt), c2)); maker.event(evt).existingMenu(menu).fillMenu( _menu -> fillMenu.get(evt.getComponent(), _menu)).run(); }); }); }