I'm a relative novice to java, and especially swing, and recently decided to try and make a simple ticktacktoe game, no AI, just the basic mechanics.
The board will represented by a two dimensional, 3 x 3, array, with each index representing a square on the ticktacktoe board.
When a space is clicked, either an 'x' or an 'o' is inserted into the corresponding index.
What I'm having trouble with is relating the array to an image of a ticktacktoe board. How will the indexes of the array be related to the squares on the board? When the user clicks a certain square on the board, how will the computer know which index of the array to place a value in?
Apologies if you find this offensively simple.