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

18
LINES

< > BotCompany Repo | #1004036 // jmenuItem

JavaX fragment (include)

1  
sbool jmenuItem_newThreads;
2  
3  
static JMenuItem jmenuItem(fS text) {
4  
  ret jMenuItem(text, null);
5  
}
6  
7  
static JMenuItem jmenuItem(fS text, fO r) {
8  
  ret swing(func -> JMenuItem {
9  
    Pair<S, Int> p = jmenu_autoMnemonic(dropPrefix("[disabled] ", text));
10  
    JMenuItem mi = new JMenuItem(p.a);
11  
    if (startsWith(text, "[disabled] ")) disableMenuItem(mi);
12  
    if (p.b != 0) mi.setMnemonic(p.b);
13  
    mi.addActionListener(jmenuItem_newThreads
14  
      ? actionListenerInNewThread(r)
15  
      : actionListener(r));
16  
    ret mi;
17  
  });
18  
}

Author comment

Began life as a copy of #1003661

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1004036
Snippet name: jmenuItem
Eternal ID of this version: #1004036/5
Text MD5: 1e0f4fafb61028bde46db26e608dfd32
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-02-15 13:04:43
Source code size: 536 bytes / 18 lines
Pitched / IR pitched: No / No
Views / Downloads: 692 / 687
Version history: 4 change(s)
Referenced in: [show references]