Java: input a matrix using GridLayout
问题 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 values to fill the 'mat' var (see FIXME below). /** * @mat: matrix declared in main (e.g: mat[][] = new int[3][3];) * @rows: number of matrix rows (e.g: int rows = 3;) * @columns: number of matrix columns (e.g: int columns = 3;) */ public static int[][] inputMatrix(int[][] mat, int rows, int columns) { JPanel panel = new