From 726e3c49af9cf61c3b11c5aa4d8a695c5450b078 Mon Sep 17 00:00:00 2001 From: tcofoegbu Date: Thu, 3 Sep 2015 15:00:34 +0100 Subject: [PATCH] JAL-1861 disable the action buttons for 1500 millisec when the ok button is clicked --- src/jalview/gui/PDBSearchPanel.java | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/jalview/gui/PDBSearchPanel.java b/src/jalview/gui/PDBSearchPanel.java index b31c637..4e23f57 100644 --- a/src/jalview/gui/PDBSearchPanel.java +++ b/src/jalview/gui/PDBSearchPanel.java @@ -195,6 +195,7 @@ public class PDBSearchPanel extends GPDBSearchPanel public void loadSelectedPDBSequencesToAlignment() { // mainFrame.dispose(); + disableActionButtons(); StringBuilder selectedIds = new StringBuilder(); HashSet selectedIdsSet = new HashSet(); int pdbIdCol = PDBRestClient.getPDBIdColumIndex(wantedFields, false); @@ -217,6 +218,35 @@ public class PDBSearchPanel extends GPDBSearchPanel seqFetcher.textArea.setText(ids); Thread worker = new Thread(seqFetcher); worker.start(); + delayAndEnableActionButtons(); + + } + + private void disableActionButtons() + { + btn_ok.setEnabled(false); + btn_back.setEnabled(false); + btn_cancel.setEnabled(false); + } + + private void delayAndEnableActionButtons() + { + new Thread() + { + public void run() + { + try + { + Thread.sleep(1500); + } catch (InterruptedException e) + { + e.printStackTrace(); + } + btn_ok.setEnabled(true); + btn_back.setEnabled(true); + btn_cancel.setEnabled(true); + } + }.start(); } public static String getPDBIdwithSpecifiedChain(String pdbId, -- 1.7.10.2