getX() and getY() return same value
I am writing an othello/reversi program for my java course at university.
I am now writing the part where clicking somewhere on the board, puts a 1 or a 2 (depending on which player's turn it is) in a string array. the method paint then loops through the array list to put a white or black oval on the matching point in the grid.
I was having trouble to get it working so I modified my mouseClicked method for debugging, and found out getY() and getX() return the same value, regardless of the position. They always return 24 for X an 5 for Y.
c is a Canvas, displaying the grid and the checkers.
public void mouseClicked(MouseEvent e)
int iXCor = c.getX();
int iYCor = c.getY();
Does anyone have any idea how I can get getX() and getY() return the value of the mouse position?