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.

!7

p-substance {
  new JMenuBar mb;
  
  // A menu for reference
  JMenu menu = new JMenu("Menu");
  addMenuItem(menu, "Item", null);
  mb.add(menu);
  
  // And the direct item
  mb.add(new JMenuItem(abstractAction("Hello", r { infoBox("Hello") })) {
    public Dimension getMaximumSize() {
        return new Dimension(
            super.getPreferredSize().width, 
            super.getMaximumSize().height);
    }
  });
  setMenuBar(mb, showFrame());
}

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: 526 / 1169
Version history: 4 change(s)
Referenced in: [show references]