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

17
LINES

< > BotCompany Repo | #1015736 - disableButtonWhileCalcing - for form button actions (with window dispose)

JavaX fragment (include)

// f returns true on ok (only then form is hidden)
static F0<Bool> disableButtonWhileCalcing(final F0<Bool> f) {
  ret func -> bool {
    final JButton button = heldInstance(JButton);
    disableButton(button);
    thread {
      temp holdInstance(button);
      try {
        bool ok = isTrue(callF(f));
        if (ok) disposeWindow(button);
      } finally {
        enableButton(button);
      }
    }
    false;
  };
}

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: #1015736
Snippet name: disableButtonWhileCalcing - for form button actions (with window dispose)
Eternal ID of this version: #1015736/5
Text MD5: 1f159aa63d6e40ebfab95c34ef1692be
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-06-18 13:11:09
Source code size: 439 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 194 / 232
Version history: 4 change(s)
Referenced in: [show references]

Formerly at http://tinybrain.de/1015736 & http://1015736.tinybrain.de