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

18
LINES

< > BotCompany Repo | #1003659 // makePopupMenu

JavaX fragment (include)

1  
static PopupMenu makePopupMenu(O... x) {
2  
  if (x == null) null;
3  
  if (l(x) == 1 && x[0] instanceof PopupMenu)
4  
    ret (PopupMenu) x[0];
5  
  new PopupMenu m;
6  
  for i over x: {
7  
    O o = x[i];
8  
    if (eqOneOf(o, "***", "---", "===", ""))
9  
      m.addSeparator();
10  
    else if (o instanceof S && get(x, i+1) instanceof Runnable)
11  
      m.add(menuItem((S) o, get(x, ++i)));
12  
    else if (o instanceof S || o instanceof Menu || o instanceof MenuItem)
13  
      call(m, "add", o);
14  
    else
15  
      print("Unknown menu item: " + o);
16  
  }
17  
  ret m;
18  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 16 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1003659
Snippet name: makePopupMenu
Eternal ID of this version: #1003659/5
Text MD5: a0afb2d5da1740ccb5e0b3768bc31675
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-11-19 23:50:22
Source code size: 545 bytes / 18 lines
Pitched / IR pitched: No / No
Views / Downloads: 470 / 536
Version history: 4 change(s)
Referenced in: [show references]