我正在尝试将JButtons添加到gridlayout上的指定位置,但我不知道该怎么做,现在我已经
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
}
}
}
}
有没有办法在网格布局中为特定情节添加按钮?