// if f returns true, form is hidden static void disableButtonWhileCalcing2(final O /*F0*/ f) { final JButton button = heldInstance(JButton); disableButton(button); thread { try { bool ok = isTrue(callF(f)); if (ok) disposePossiblyInternalFrame(button); } finally { enableButton(button); } } }