title: How to add a score counter to my tic tac toe
body: <p>I have a tic tac toe game created with java swing and I want to add a counter to score how many games have been won by either player.
  I just need a counter that counts the score and I don't know how to add this</p>
  
  <p>This is my code below:</p>
  
  <pre><code>package Game;
  
  import java.util.Scanner;
  
  public class Main {
  
      public static  boolean playerTurn = true;
      public static  boolean playerWon = false;
      public static  boolean computerWon = false;
      public static  boolean playing = true;
      public static  Scanner scan = new Scanner(System.in);
      public static  boolean playAgain = false;
  
  
      public static  tictactoe board = new tictactoe();
  
      public static void main(String[] args){
              if(board.isVisible() == false){
                  board.setVisible(true);
  
      if(playerWon == true || computerWon == true){
  
      System.out.println("Would you like to play again!? true or false");
      playAgain = scan.nextBoolean();
      if(playAgain == true ){
      board.setVisible(false);
      System.out.println("Player1 Won: " + playerWon);
      System.out.println("Player2 Won: " + computerWon);
      board.button1.setText("");
      board.button2.setText("");
      board.button3.setText("");
      board.button4.setText("");
      board.button5.setText("");
      board.button6.setText("");
      board.button7.setText("");
      board.button8.setText("");
      board.button9.setText("");                                              
      playerTurn = true;
      playerWon = false;
      computerWon = false;
      board.setVisible(true);
      else 
  
      System.out.println("Thanks for playing...! ");}
  </code></pre>