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

43
LINES

< > BotCompany Repo | #1018401 // Task Bar v1 [horizontal only, Dyn Module]

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Libraryless. Click here for Pure Java version (5304L/35K).

!7

sclass TaskBar extends DynSCP {
  transient SimpleLiveValue<S> lvInvisible = stringLiveValue();

  JComponent visualize2() {
    ret centerAndEast(hgrid(makeButtons()), withLeftAndRightMargin(6, 3, onLeftClick(jLiveValueLabel(lvInvisible), r dm_showInvisibleModulesList)));
  }
  
  void enhanceFrame(Container f) {
    super.enhanceFrame(f);
    addTitlePopupMenuItem(f, "Place on bottom", rThread placeOnBottom);
  }
  
  void placeOnBottom {
    Container frame = dm_frame();
    Rectangle desktop = getBounds(dm_desktopPane());
    if (frame != null && desktop != null) {
      packInternalFrameVertically_noFix((JInternalFrame) frame);
      Rectangle me = getBounds(frame);
      dm_setBounds(dm_current(), 0, desktop.height-me.height,   
        desktop.width, me.height);
    }
  }
 
  void update { revisualize2(); }
  
  L<JButton> makeButtons() {
    new L<JButton> out;
    new L invisible;
    L modules = dm_listModules();
    // TODO: get module names all at once
    for (fO m : modules)
      if (m != this)
        if (dm_isVisible(m)) {
          final WeakReference ref = new(m); // allow GC for modules
          out.add(jbutton(dm_moduleName(m), r { dm_showModule(ref!) }));
        } else invisible.add(m);
    lvInvisible.set(empty(invisible) ? "" : "+ " + l(invisible) + " invisible");

    ret out;
  }
}

Author comment

Began life as a copy of #1016123

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1018401
Snippet name: Task Bar v1 [horizontal only, Dyn Module]
Eternal ID of this version: #1018401/1
Text MD5: 7be472b880dbc738b0502f39fb664e78
Transpilation MD5: ff34cfdfd050c686aa17f970626b0e52
Author: stefan
Category: javax
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-09-26 12:11:45
Source code size: 1376 bytes / 43 lines
Pitched / IR pitched: No / No
Views / Downloads: 261 / 318
Referenced in: [show references]