title: Java: Waiting for mouse input (click)
body: <p>I am making some sort of turn-based battle system in a JFrame where the player clicks a button when it's his turn. The problem is: how can the program wait for a mouse click on the button? It goes like this:</p>
  
  <p>while it is the player's turn { </p>
  
  <ul>
  <li><p>wait for mouse input</p></li>
  <li><p>if input == attack (for example)</p>
  
  <pre><code>   -&gt; attack
  </code></pre>
  
  <p>else if input == item</p>
  
  <pre><code>   -&gt; use item
  </code></pre>
  
  <p>and so on</p></li>
  </ul>