I am trying to write a function that can input a matrix of any size using a GridLayout, but I\'m stuck since I can\'t find an appropriate way of extracting the JTextField va
Let's say you have a 3-row x 3-column grid. Since GridLayout adds by rows, then the 1st item of the second row would be the 4th item that you added to the grid. You could retrieve this item by calling panel.getComponent(3) (zero index so 4th item is at index 3).
So - you could just use getComponent, doing a little math to figure out the right index based on the number of columns and the i,j coordinates in the matrix.