title: Wait until any button is pressed?
body: <p>I am writing a TicTacToe game in JavaFX. I've decided to make a board as 9 (3x3) buttons with changing text: "" (if empty) or "X" or "O". Everything is going ok beside one thing... I got stuck here:</p>
  
  <pre><code>public void game() {
  
          while(keepPlaying) {
              if(computerTurn) {;
                  computerMove();
              }else {
                  while(waitForUser) {
                      //wait until any of 9 buttons is pushed!
                  }
              }
  
              if (checkResult()) {
                  keepPlaying = false;
              }
              computerTurn = !computerTurn;
          }
      }
  </code></pre>
  
  <p>How to wait for user pushing any of those 9 buttons and then continue with computer turn??</p>
  
  <p>I need something like waiting for scanner input in console application, but this input must be one of 9 buttons...</p>
  
  <p>I know that there are few "possible duplicates", but in fact those problems were solved using methods I can't use here, for example timer. Correct me if I am wrong.</p>