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

20
LINES

< > BotCompany Repo | #1010357 // Test adding a JMenuItem to JMenuBar directly [OK]

JavaX source code (desktop) [tags: use-pretranspiled] - run with: x30.jar

Download Jar. Transpiled version (2870L) is out of date.

1  
!7
2  
3  
p-substance {
4  
  new JMenuBar mb;
5  
  
6  
  // A menu for reference
7  
  JMenu menu = new JMenu("Menu");
8  
  addMenuItem(menu, "Item", null);
9  
  mb.add(menu);
10  
  
11  
  // And the direct item
12  
  mb.add(new JMenuItem(abstractAction("Hello", r { infoBox("Hello") })) {
13  
    public Dimension getMaximumSize() {
14  
        return new Dimension(
15  
            super.getPreferredSize().width, 
16  
            super.getMaximumSize().height);
17  
    }
18  
  });
19  
  setMenuBar(mb, showFrame());
20  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1010357
Snippet name: Test adding a JMenuItem to JMenuBar directly [OK]
Eternal ID of this version: #1010357/5
Text MD5: a87cac5e7c16af5df7671e6a6f75fd4f
Author: stefan
Category: javax / gui
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-09-12 16:14:52
Source code size: 475 bytes / 20 lines
Pitched / IR pitched: No / No
Views / Downloads: 528 / 1171
Version history: 4 change(s)
Referenced in: [show references]