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


< > BotCompany Repo | #1014599 - inputText - show input form for single-line text, call action on enter (in new thread)

JavaX fragment (include)

static void inputText(fS msg, fO action) {
  inputText(msg, "", action);

// action: voidfunc(S)
svoid inputText(fS msg, final S defaultText, fO action) {
  fO threadInfo = _threadInfo();
  awt {
    final JTextField tf = jtextfield(defaultText);
    S title = joinStrings(" | ", msg, programName());
    JComponent form = showFormTitled(title,
      unnull(msg), tf,
      r {
        vmBus_send('inputtingText_OK, threadInfo, msg, tf);
        callF_thread(action, getTextTrim(tf))
    renameSubmitButton(form, "OK");
    vmBus_send('inputtingText, threadInfo, msg, tf);

svoid inputText(S msg, S defaultText, IVF1<S> action) {
  inputText(msg, defaultText, (O) action);

svoid inputText(S msg, IVF1<S> action) {
  inputText(msg, (O) action);

Author comment

Began life as a copy of #1006692

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1014599
Snippet name: inputText - show input form for single-line text, call action on enter (in new thread)
Eternal ID of this version: #1014599/10
Text MD5: b28e107c7c49ce3a6a582f7932922d88
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-02-26 18:38:33
Source code size: 793 bytes / 28 lines
Pitched / IR pitched: No / No
Views / Downloads: 264 / 304
Version history: 9 change(s)
Referenced in: [show references]

Formerly at &