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)

sclass OptionalInputPanel {
  //DynModule module;
  JPanel panel;
  JTextField tfInput;
  JCheckBox cbInput;
  
  *() { this(dm_current()); }
  
  *(final DynModule module) {
    tfInput = jcenteredtextfield();
    cbInput = jcheckbox();

    onChangeAndNow(cbInput, r {
      setEnabled(tfInput, isChecked(cbInput));
      module.updateMe(); });
    onChange(tfInput, r {
      if (isChecked(cbInput)) module.updateMe()
    });
    panel = westAndCenter(cbInput, tfInput);
  }
  
  JComponent panel() { ret panel; }
  JComponent swing() { ret panel; }
  
  S input() {
    bool myInput = isChecked(cbInput);
    fS s = trim(myInput ? getText(tfInput) : dm_getInterestingString());
    if (!myInput) setText(tfInput, s);
    ret s;
  }
}

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: 370 / 944
Version history: 5 change(s)
Referenced in: [show references]