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).

1  
!7
2  
3  
sclass TaskBar extends DynSCP {
4  
  transient SimpleLiveValue<S> lvInvisible = stringLiveValue();
5  
6  
  JComponent visualize2() {
7  
    ret centerAndEast(hgrid(makeButtons()), withLeftAndRightMargin(6, 3, onLeftClick(jLiveValueLabel(lvInvisible), r dm_showInvisibleModulesList)));
8  
  }
9  
  
10  
  void enhanceFrame(Container f) {
11  
    super.enhanceFrame(f);
12  
    addTitlePopupMenuItem(f, "Place on bottom", rThread placeOnBottom);
13  
  }
14  
  
15  
  void placeOnBottom {
16  
    Container frame = dm_frame();
17  
    Rectangle desktop = getBounds(dm_desktopPane());
18  
    if (frame != null && desktop != null) {
19  
      packInternalFrameVertically_noFix((JInternalFrame) frame);
20  
      Rectangle me = getBounds(frame);
21  
      dm_setBounds(dm_current(), 0, desktop.height-me.height,   
22  
        desktop.width, me.height);
23  
    }
24  
  }
25  
 
26  
  void update { revisualize2(); }
27  
  
28  
  L<JButton> makeButtons() {
29  
    new L<JButton> out;
30  
    new L invisible;
31  
    L modules = dm_listModules();
32  
    // TODO: get module names all at once
33  
    for (fO m : modules)
34  
      if (m != this)
35  
        if (dm_isVisible(m)) {
36  
          final WeakReference ref = new(m); // allow GC for modules
37  
          out.add(jbutton(dm_moduleName(m), r { dm_showModule(ref!) }));
38  
        } else invisible.add(m);
39  
    lvInvisible.set(empty(invisible) ? "" : "+ " + l(invisible) + " invisible");
40  
41  
    ret out;
42  
  }
43  
}

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: 263 / 320
Referenced in: [show references]