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)

1  
// f returns true on ok (only then form is hidden)
2  
static F0<Bool> disableButtonWhileCalcing(final F0<Bool> f) {
3  
  ret func -> bool {
4  
    final JButton button = heldInstance(JButton);
5  
    disableButton(button);
6  
    thread {
7  
      temp holdInstance(button);
8  
      try {
9  
        bool ok = isTrue(callF(f));
10  
        if (ok) disposeWindow(button);
11  
      } finally {
12  
        enableButton(button);
13  
      }
14  
    }
15  
    false;
16  
  };
17  
}

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: 332 / 386
Version history: 4 change(s)
Referenced in: [show references]