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

19
LINES

< > BotCompany Repo | #1007473 // addToMenu

JavaX fragment (include)

static JMenu addToMenu(Component c, S menuName, O... items) {
  ret addToMenu(getFrame(c), menuName, items);
}

static JMenu addToMenu(final JFrame frame, fS menuName, fO... items) {
  ret (JMenu) swing(func {
    JMenuBar bar = addMenuBar(frame);
    JMenu menu = getMenuNamed(bar, menuName);
    bool isNew = menu == null;
    if (isNew)
      menu = new JMenu(menuName);
    fillJMenu(menu, items);
    if (isNew) {
      bar.add(menu);
      revalidateFrame(frame);
    }
    ret menu;
  });
}

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: 482 / 485
Version history: 1 change(s)
Referenced in: [show references]