static AutoCloseable tempDisableButton(final JButton b) { if (b == null) null; bool wasEnabled = swing(func -> bool { bool b = isEnabled(button); if (b) disableButton(b); ret b; }); if (!wasEnabled) null; ret autocloseable { enableButton(b); }; }