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

18
LINES

< > BotCompany Repo | #1003659 // makePopupMenu

JavaX fragment (include)

static PopupMenu makePopupMenu(O... x) {
  if (x == null) null;
  if (l(x) == 1 && x[0] instanceof PopupMenu)
    ret (PopupMenu) x[0];
  new PopupMenu m;
  for i over x: {
    O o = x[i];
    if (eqOneOf(o, "***", "---", "===", ""))
      m.addSeparator();
    else if (o instanceof S && get(x, i+1) instanceof Runnable)
      m.add(menuItem((S) o, get(x, ++i)));
    else if (o instanceof S || o instanceof Menu || o instanceof MenuItem)
      call(m, "add", o);
    else
      print("Unknown menu item: " + o);
  }
  ret m;
}

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: 628 / 707
Version history: 4 change(s)
Referenced in: #1004035 - fillJMenu
#1006654 - Standard functions list 2 (LIVE, continuation of #761)