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).

static <A extends JComponent> A componentPopupMenuItem(A c, S name, Runnable action) {
  componentPopupMenu(c, voidfunc(JPopupMenu menu) {
    addMenuItem(menu, name, action);
  });
  ret c;
}

static void componentPopupMenuItem(JComponent c, JMenuItem menuItem) {
  componentPopupMenu(c, voidfunc(JPopupMenu menu) {
    addMenuItem(menu, menuItem);
  });
}

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: 595 / 662
Version history: 4 change(s)
Referenced in: [show references]