I'd like to make a grid in a JPanel full of buttons, then i want to create them in a loop because i've aproximatly 100 buttons. Each button created must have an id differents see my picture to understand better :s
I think I have to create a method like this but I don't know how to proceed :
public Button(String text , int id){
//code
}
And then add it to a loop to create the grid :)
if anyone can help me it would be very appreciated ! ;)
Each
GridButton
"knows its location on the grid." The complete example shows how to create the buttons in a loop and how to calculate grid coordinates in aList<GridButton>
.