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

31
LINES

< > BotCompany Repo | #1010517 // replaceConsoleInputWithAutoComboBox - experimental

JavaX fragment (include)

static AutoComboBox replaceConsoleInputWithAutoComboBox() {
  ret replaceConsoleInputWithAutoComboBox(new L);
}

static AutoComboBox replaceConsoleInputWithAutoComboBox(final Collection<S> items) {
  // Upgrade JavaX in place
  if (getOpt(javax(), 'generalMap) == null) {
    run(#1001639);
    restart();
    sleep();
  }
      
  ret swing(func -> AutoComboBox {
    final AutoComboBox cb = autoComboBox(items);
    
    onEnter(cb, r {
      PipedOutputStream pout3 = cast _get(javax(), 'pout3);
      S line = getText(cb);
      try {
        pout3.write(toUtf8(line + "\n"));
        pout3.flush();
      } catch (Exception e) {}
      cb.getEditor().selectAll();
    });
    
    awtReplaceComponent(consoleInputField(), cb);
    setOpt(_get(javax(), 'console), cbInput := cb);
    setOpt(_get(javax(), 'console), tfInput := cb.getEditor().getEditorComponent());
    ret cb;
  });
}

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1010517
Snippet name: replaceConsoleInputWithAutoComboBox - experimental
Eternal ID of this version: #1010517/16
Text MD5: cb4decbd94089f956cf2f50416c432e0
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-09-19 19:33:30
Source code size: 918 bytes / 31 lines
Pitched / IR pitched: No / No
Views / Downloads: 369 / 387
Version history: 15 change(s)
Referenced in: [show references]