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

16
LINES

< > BotCompany Repo | #1010361 // addDirectMenuItem - add JMenuItem to JMenuBar

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

Libraryless. Click here for Pure Java version (3021L/18K).

1  
static void addDirectMenuItem(JMenuBar mb, S text, O action) {
2  
  if (mb != null) swing {
3  
    addDirectMenuItem(mb, directJMenuItem(text, action));
4  
  }
5  
}
6  
7  
static void addDirectMenuItem(Component c, S text, O action) {
8  
  addDirectMenuItem(addMenuBar(c), text, action);
9  
}
10  
11  
svoid addDirectMenuItem(JMenuBar mb, JMenuItem menuItem) {
12  
  if (mb != null) swing {
13  
    mb.add(menuItem);
14  
    revalidate(mb);
15  
  }
16  
}

Author comment

Began life as a copy of #1005735

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: #1010361
Snippet name: addDirectMenuItem - add JMenuItem to JMenuBar
Eternal ID of this version: #1010361/5
Text MD5: e58570fab1348638ae61ddc3f7636331
Transpilation MD5: 40489835bfab8fa23941536a7b3b1ba6
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-05-06 13:33:20
Source code size: 417 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 432 / 490
Version history: 4 change(s)
Referenced in: [show references]