title: Is there a Java method to determine if a JButton is clicked?
body: <p>I am creating a basic calculator GUI and I have created JHoverButtons and a text field that only allows integer inputs. Now what I am trying to do is have it so that if for example, the hover button that says "1" on it is clicked by the user, then the text field would display "1" just as the user has done so by clicking the button.</p>
  
  <p>So I have created if-statements to do as I had detailed above and this is what I had written for that:</p>
  
  <pre><code>if (hoverOne.isSelected()){
          integerInput.setText("1");
      }
  </code></pre>
  
  <p>Turns out the isSelected method is for toggle buttons with which my hover buttons are not so when I run the file, it doesn't do what I wanted. I named the text field in the GUI as integerInput and the hover button with "1" on it as hoverOne. </p>
  
  <p>How can I get it so that when a user clicks the button, the text field displays the number the user entered?</p>