java - How to edit a specific JButton's data -


i have code:

 jbutton[][] grid;     grid = new jbutton[15][13];     (int x = 0; x < 15; x++) {         (int y = 0; y < 13; y++) {             grid[x][y] = new jbutton("(" + x + "," + y + ")");             frame.add(grid[x][y]);         }     } 

my question is, how edit specific jbutton? let's want add different text jbutton @ [2][2]. ultimately, i'd add other things actionlistener , such button, primary question how access specific button.

you can use grid[2][2] button, access normal two-dimension array.


Comments