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

32
LINES

< > BotCompany Repo | #1022773 // DynBigInputAndSections

JavaX fragment (include)

abstract sclass DynBigInputAndSections extends DynModule {
  S text;
  switchable int fontSize = 20;
  bool maximizeSingleSection = true;
  transient JPanel stack;
  transient Trigger trigger_makeSections = new(r makeSections);

  start { onChange(trigger_makeSections); }

  visual withComputing(trigger_makeSections,
    jvsplit(wrapTextArea(setFontSize(fontSize, dm_textArea('text))),
      jscroll_verticalExtend(stack = customLayoutPanel_trackWidth(
        nu StackLayouter(maximizeIfSingleComponent := maximizeSingleSection)))));
        
  JComponent wrapTextArea(JTextArea textArea) { ret textArea; }
      
  void makeSections() q {
    if (stack == null || !trigger_makeSections.check()) ret;
    removeAllComponents(stack);
    makeSections_impl();
    print("Have sections: " + componentCount(stack));
    print("Stack parent=" + getParent(stack));
  }
  
  // override me. stack is already cleared. we're in the module queue
  void makeSections_impl {}
  
  // only call in makeSections_impl()
  void addSection(S name, Component contents) {
    addComponent(stack, jSection(name, contents));
  }
}

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: 306 / 754
Version history: 10 change(s)
Referenced in: [show references]