Libraryless. Click here for Pure Java version (11200L/63K).
static AutoCloseable tempGlobalPopupMenu(IVF2<Component, JPopupMenu> fillMenu, double delay default 0.1) { ret fillMenu == null ?: tempAddPopupButtonListener(evt -> { var c = evt.getComponent(); if (c == null) ret; // It's a tray icon popup var c2 = SwingUtilities.getDeepestComponentAt(c, evt.getX(), evt.getY()); var p = ptInComponentFromEvent(evt); var p2 = translateLocationBetweenComponents(p, c2); awtLater(delay, r { var menu = currentPopupMenu(); print("Pimping popup menu " + menu); new PopupMenuMaker maker; maker.ptInComponent(p2); maker.event(evt).existingMenu(menu).fillMenu( _menu -> fillMenu.get(c2, _menu)).run(); }); }); }
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, ekrmjmnbrukm, mqqgnosmbjvj
No comments. add comment
| Snippet ID: | #1034620 |
| Snippet name: | tempGlobalPopupMenu - popup menu items for any component on screen |
| Eternal ID of this version: | #1034620/18 |
| Text MD5: | 649fffea9f835c8fe82e498b52105fc4 |
| Transpilation MD5: | 28cdf5ee88d10a9ace9315febf13fa01 |
| Author: | stefan |
| Category: | javax / gui |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2023-01-31 14:57:55 |
| Source code size: | 741 bytes / 19 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 772 / 969 |
| Version history: | 17 change(s) |
| Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) |