I am studying a java tutorial and saw that the way to find the x/y indexes of a JButton inside a GridLayout is to traverse a bidimensional array of buttons b which is associ
You have saved an array of all JButtons; you could search for ae.getSource() and you have the position.
ae.getSource()
for (int i = 0; i < 5; i++) { for (int j = 0; j < 5; j++) { if( b[i][j] == ae.getSource() ) { // position i,j } } }