title: Clicking a JButton twice in a row
body: <p>I was wondering if there was a built in function in java or a way to check if a JButton is clicked twice in a row. This is not to be confused with keeping track of how many times a JButton has been clicked or double clicking a JButton. I have searched multiple threads and they all seem to be talking about the latter.</p>
  
  <p>I have the following code that works if a button called <code>button1</code> is clicked once. I need a bit of help tweaking it to work for when the button is clicked twice i.e, back to back.</p>
  
  <pre><code>public void actionPerformed(ActionEvent arg0){
      JButton button1 = (JButton) arg0.getSource();
      if (button1 == button1) {
          //You clicked button1 twice in a row
      }
  }
  </code></pre>