sclass componentPopupMenu_Maker { new L menuMakers; } static Map<JComponent, componentPopupMenu_Maker> componentPopupMenu_map = new WeakHashMap; static new ThreadLocal<MouseEvent> componentPopupMenu_mouseEvent; // menuMaker = voidfunc(JPopupMenu) static void componentPopupMenu(final JComponent component, fO menuMaker) { awtIfNecessary { componentPopupMenu_Maker maker = componentPopupMenu_map.get(component); if (maker == null) { componentPopupMenu_map.put(component, maker = new componentPopupMenu_Maker); final componentPopupMenu_Maker _maker = maker; component.addMouseListener(new MouseAdapter { public void mousePressed(MouseEvent e) { displayMenu(e); } public void mouseReleased(MouseEvent e) { displayMenu(e); } void displayMenu(MouseEvent e) { if (e.isPopupTrigger()) { new JPopupMenu menu; int emptyCount = menu.getComponentCount(); componentPopupMenu_mouseEvent.set(e); for (O menuMaker : _maker.menuMakers) pcallF(menuMaker, menu); // show menu if any items in it if (menu.getComponentCount() != emptyCount) menu.show(e.getComponent(), e.getX(), e.getY()); } } }); } maker.menuMakers.add(menuMaker); } }
Began life as a copy of #1005719
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1007780 |
Snippet name: | componentPopupMenu backup |
Eternal ID of this version: | #1007780/1 |
Text MD5: | 1aea1a671e05d3353c8fd91229ef5930 |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-04-06 11:58:42 |
Source code size: | 1387 bytes / 38 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 590 / 554 |
Referenced in: | [show references] |