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

19
LINES

< > BotCompany Repo | #1007473 // addToMenu

JavaX fragment (include)

1  
static JMenu addToMenu(Component c, S menuName, O... items) {
2  
  ret addToMenu(getFrame(c), menuName, items);
3  
}
4  
5  
static JMenu addToMenu(final JFrame frame, fS menuName, fO... items) {
6  
  ret (JMenu) swing(func {
7  
    JMenuBar bar = addMenuBar(frame);
8  
    JMenu menu = getMenuNamed(bar, menuName);
9  
    bool isNew = menu == null;
10  
    if (isNew)
11  
      menu = new JMenu(menuName);
12  
    fillJMenu(menu, items);
13  
    if (isNew) {
14  
      bar.add(menu);
15  
      revalidateFrame(frame);
16  
    }
17  
    ret menu;
18  
  });
19  
}

Author comment

Began life as a copy of #1004034

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mowyntqkapby, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1007473
Snippet name: addToMenu
Eternal ID of this version: #1007473/2
Text MD5: ccf46cebad24fc68d91698bead3500bd
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-03-24 16:54:55
Source code size: 515 bytes / 19 lines
Pitched / IR pitched: No / No
Views / Downloads: 620 / 601
Version history: 1 change(s)
Referenced in: [show references]