static void disableSubmitButton(Component form) { swing { JButton btn = findSubmitButton(form); if (btn != null) btn.setEnabled(false); } }