我製作了3x3魔方檢查器。我只是想知道如何能夠將我的9個JTextFields存儲在數組中?
這樣我就可以通過二維數組,並迅速分配值的JTextField的循環,因爲我在我的存儲值的方式是遠遠高效...
您可以在NetBeans中創建一個JTextFields數組嗎?
int[][] grid = new int[3][3];
grid[0][0] = new Integer(one.getText());
grid[0][1] = new Integer(two.getText());
grid[0][2] = new Integer(three.getText());
grid[1][0] = new Integer(four.getText());
grid[1][1] = new Integer(five.getText());
grid[1][2] = new Integer(six.getText());
grid[2][0] = new Integer(seven.getText());
grid[2][1] = new Integer(eight.getText());
grid[2][2] = new Integer(nine.getText());
like'JTextFields [] [] = new JTextFields [3] [3];'? –