Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

12
LINES

< > BotCompany Repo | #1007911 // componentPopupMenuItem - adds to the menu if it already exists

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (11142L/62K).

1  
static <A extends JComponent> A componentPopupMenuItem(A c, S name, Runnable action) {
2  
  componentPopupMenu(c, voidfunc(JPopupMenu menu) {
3  
    addMenuItem(menu, name, action);
4  
  });
5  
  ret c;
6  
}
7  
8  
static void componentPopupMenuItem(JComponent c, JMenuItem menuItem) {
9  
  componentPopupMenu(c, voidfunc(JPopupMenu menu) {
10  
    addMenuItem(menu, menuItem);
11  
  });
12  
}

Author comment

Began life as a copy of #1006764

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: #1007911
Snippet name: componentPopupMenuItem - adds to the menu if it already exists
Eternal ID of this version: #1007911/5
Text MD5: 21f619f43f3a112077d4b645128c1ca3
Transpilation MD5: af0c5ba1861733ae439bb9f58eafaad7
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2023-01-15 19:20:12
Source code size: 368 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 684 / 777
Version history: 4 change(s)
Referenced in: [show references]