计算要添加的按钮数量时,我需要添加按钮。
我有我的按钮在这里创建代码..:
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() ) );
}
}
}
}
现在我如何告诉程序需要在屏幕上添加新按钮?
谢谢