title: Disable JButton after click and enable when it done it's job
body: <p>I have a JButton which has an ActionListener, which does its job as many times as I click it. Below is my code:</p>
  <pre><code>   mouseListener = new ActionListener() {
          public void actionPerformed(ActionEvent e) {
                  JButton source = (JButton) e.getSource();
                  source.setEnabled(false);
                  try {
                      RequestCommon.ctbCookie = jtf.getText();
                      System.out.println(RequestCommon.ctbCookie);
                      HttpURLConnection connection = HttpURLConnectionBuilder.getConnection(RequestCommon.login, RequestCommon.getCtb888Headers());
                      String connectionOuput = HttpURLConnectionBuilder.getConnectionOuput(connection);
                      System.out.println(connectionOuput);
                      new Player(new BufferedInputStream(new FileInputStream(new File(&quot;sounds/8.mp3&quot;)))).play();
                  } catch (IOException e1) {
                      e1.printStackTrace();
                  } catch (JavaLayerException e1) {
                      e1.printStackTrace();
                  }
                  source.setEnabled(true);
          }
      }
      jb1.addActionListener(mouseListener);
  </code></pre>
  <p>I want it so that no matter how many times I click while the job is running it won't execute again. When the job is done, if I click again, the job will run again. I don't know how to do that, please tell me if you know, thanks!</p>