我正在尝试将 JButtons 添加到网格布局上的指定位置,但我不确定如何执行此操作,现在我有
public void addButtons()
{
myBoard = myController.getMyBoard();
for (int i = 0; i < this.getEntryInt(); i++)
{
for(int j = 0 ; j < this.getEntryInt(); j++)
{
if(myBoard[i][j]==true)
{
buttons[i][j] = new JButton("Q"); // error: The type of the expression must be an array type but it resolved to JButton
}
}
}
}
有没有办法将按钮添加到网格布局中的特定绘图?