// f returns true on ok (only then form is hidden) static F0 disableButtonWhileCalcing(final F0 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; }; }