0
寫作基本方法我的代碼使用多維數組在Java中
_grid[4][4].setText(_square[4][4].getTopColor() + ": "
+ _square[4][4].getHeight());
最終在我的程序,文本將改變,因爲get.Height的值將改變這一點。有沒有辦法編寫一個簡單的程序,根據多維數組的座標設置文本?所以如果方法被調用updateText,我可以做_grid [4] [4] .updateText();它會和上面的代碼一樣。或者,如果我沒有_grid [0] [12] .updateText(),它會做同樣的,因爲這:
_grid[0][12].setText(_square[0][12].getTopColor() + ": "
+ _square[0][12].getHeight());