これは簡単なことかもしれませんが、範囲外の例外が発生し、修正方法がわかりません。
基本的に、整数フィールドの「テーブル」を作成して、それらを使用して整数フィールドのすべての値が魔方陣を作成するかどうかを確認しようとしています。ネストされた for ループは最大 8x8 の正方形を作成する必要があり、正方形の最初の行を作成しますが、代わりに範囲外のエラーが発生します。
GUI に IntegerField を追加しているネストされた for ループ内でエラーが発生します。
誰かが助けることができれば、それは素晴らしいことです。詳細が必要な場合はお知らせください。
import javax.swing.*;
import BreezySwing.*;
public class Interface extends GBFrame{ 
    //Create integerField array to create input for magic square
    public IntegerField[][] magicSquare;
    //Create input button, integer field which sets size of square
    public IntegerField squareSize;
    public JButton inputSize;
    //Create check square button
    public JButton checkSquare;
    //Label to output if there is a magic square
    public JLabel squareLabel;
    //Size of square variable
    public int size;
    //CalcSquare object
    CalcSquare calc = new CalcSquare();
    //Constructor for Square interface
    public Interface()
    {
        squareSize = addIntegerField (0, 1, 1, 1, 1);
        inputSize = addButton ("Input Size", 2, 1, 1, 1);
        squareLabel = addLabel ("", 3, 1, 1, 1);
        checkSquare = addButton ("Check Square", 4, 1, 1, 1);
    }   
    //Creates IntegerFields on the GUI as needed.
    public void createFields()
    {
        for (int i = 0; i <= size; i++)
        {
            for (int x = 0; x <= size; x++)
            {
                magicSquare = new IntegerField[i][x];
    }
        }
    }
public void buttonClicked(JButton buttonObj)
{
        if (buttonObj == inputSize)
        {
            size = squareSize.getNumber();
            createFields();
            for (int i = 0; i <= size; i++)
            {
                for (int x = 0; x <= size; x++)
                {
                    magicSquare[i][x] = addIntegerField (0, i+1, x+1, 1, 1);
                }
            }   
        }
        else if (buttonObj == checkSquare)
        {       
        }
    }
}