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

31
LINES

< > BotCompany Repo | #1016430 // OptionalInputPanel - use InputChooser instead now. takes input either from InterestingString or from its own text field

JavaX fragment (include)

1  
sclass OptionalInputPanel {
2  
  //DynModule module;
3  
  JPanel panel;
4  
  JTextField tfInput;
5  
  JCheckBox cbInput;
6  
  
7  
  *() { this(dm_current()); }
8  
  
9  
  *(final DynModule module) {
10  
    tfInput = jcenteredtextfield();
11  
    cbInput = jcheckbox();
12  
13  
    onChangeAndNow(cbInput, r {
14  
      setEnabled(tfInput, isChecked(cbInput));
15  
      module.updateMe(); });
16  
    onChange(tfInput, r {
17  
      if (isChecked(cbInput)) module.updateMe()
18  
    });
19  
    panel = westAndCenter(cbInput, tfInput);
20  
  }
21  
  
22  
  JComponent panel() { ret panel; }
23  
  JComponent swing() { ret panel; }
24  
  
25  
  S input() {
26  
    bool myInput = isChecked(cbInput);
27  
    fS s = trim(myInput ? getText(tfInput) : dm_getInterestingString());
28  
    if (!myInput) setText(tfInput, s);
29  
    ret s;
30  
  }
31  
}

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: #1016430
Snippet name: OptionalInputPanel - use InputChooser instead now. takes input either from InterestingString or from its own text field
Eternal ID of this version: #1016430/6
Text MD5: 6a922ff2ea1476e68c1017615d7880b4
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-06-24 18:21:40
Source code size: 769 bytes / 31 lines
Pitched / IR pitched: No / No
Views / Downloads: 379 / 953
Version history: 5 change(s)
Referenced in: [show references]