I need to add buttons when the amount of buttons to add is calculated.
I have my button creating code hereish..:
private void loadButtons()
{
if (active_puzzle != null)
{
int devider = 5;
int count = 0;
JButton puzzleButton[] = new JButton[active_puzzle.getNumberOfPieces()];
for(int row = 0; row < active_puzzle.getRows(); row++)
{
for(int column = 0; column < active_puzzle.getColumns(); column++)
{
puzzleButton[count] = new JButton(new ImageIcon( active_puzzle.getPieces()[count].getPieceImage() ) );
}
}
}
}
Now how to I tell the program that new buttons need to be added to the screen?
Thank you