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

32
LINES

< > BotCompany Repo | #1022773 // DynBigInputAndSections

JavaX fragment (include)

1  
abstract sclass DynBigInputAndSections extends DynModule {
2  
  S text;
3  
  switchable int fontSize = 20;
4  
  bool maximizeSingleSection = true;
5  
  transient JPanel stack;
6  
  transient Trigger trigger_makeSections = new(r makeSections);
7  
8  
  start { onChange(trigger_makeSections); }
9  
10  
  visual withComputing(trigger_makeSections,
11  
    jvsplit(wrapTextArea(setFontSize(fontSize, dm_textArea('text))),
12  
      jscroll_verticalExtend(stack = customLayoutPanel_trackWidth(
13  
        nu StackLayouter(maximizeIfSingleComponent := maximizeSingleSection)))));
14  
        
15  
  JComponent wrapTextArea(JTextArea textArea) { ret textArea; }
16  
      
17  
  void makeSections() q {
18  
    if (stack == null || !trigger_makeSections.check()) ret;
19  
    removeAllComponents(stack);
20  
    makeSections_impl();
21  
    print("Have sections: " + componentCount(stack));
22  
    print("Stack parent=" + getParent(stack));
23  
  }
24  
  
25  
  // override me. stack is already cleared. we're in the module queue
26  
  void makeSections_impl {}
27  
  
28  
  // only call in makeSections_impl()
29  
  void addSection(S name, Component contents) {
30  
    addComponent(stack, jSection(name, contents));
31  
  }
32  
}

Author comment

Began life as a copy of #1022759

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1022773
Snippet name: DynBigInputAndSections
Eternal ID of this version: #1022773/11
Text MD5: d8beb1a765c0cba432699b676dc03f79
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-04-14 19:11:59
Source code size: 1143 bytes / 32 lines
Pitched / IR pitched: No / No
Views / Downloads: 307 / 755
Version history: 10 change(s)
Referenced in: [show references]