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

21
LINES

< > BotCompany Repo | #1015819 - internalFrameTitlePopupMenu - add popup menu items to title bars (certain L&Fs only)

JavaX fragment (include)

// menuMaker = voidfunc(JPopupMenu)
static void internalFrameTitlePopupMenu(final JInternalFrame f, fO... params) {
  swing {
    O menuMaker;
    if (l(params) == 1 && !(params[0] instanceof JMenu))
      menuMaker = params[0];
    else
      menuMaker = voidfunc(JPopupMenu menu) { addMenuItems(menu, params) };
    
    Component titleComponent = getInternalFrameTitlePaneComponent(f);
    if (!titleComponent instanceof JComponent)
      print("Can't add internal frame title popup menu!");
    else {
      componentPopupMenu((JComponent) titleComponent, menuMaker);
      setOpt(componentPopupMenu_initForComponent((JComponent) titleComponent), internalFrameLeftButtonMagic := isTrue(vm_generalMap_get('internalFramePopupOnLeftButton)));
    }
      
    // Also add to the frame so we can show the items e.g. in a JFrame menu
    componentPopupMenu(f, menuMaker);
  }
}

Author comment

Began life as a copy of #1005777

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1015819
Snippet name: internalFrameTitlePopupMenu - add popup menu items to title bars (certain L&Fs only)
Eternal ID of this version: #1015819/15
Text MD5: 9a74c1b8d438027de320a29a49ee0f31
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-07-23 20:51:39
Source code size: 896 bytes / 21 lines
Pitched / IR pitched: No / No
Views / Downloads: 250 / 319
Version history: 14 change(s)
Referenced in: [show references]

Formerly at http://tinybrain.de/1015819 & http://1015819.tinybrain.de