1

数独プログラムを作成していますが、JFrame の My GridLayout の間隔を変更したいと考えています。現在、上部に 1 つ、下部に 1 つの 2 つの JPanel があり、間隔はちょうど半分です。ただし、最上位の JPanel には JFrame により多くのスペースが必要です。私のコードは次のとおりです。

    import java.awt.GridLayout;

    import javax.swing.BoxLayout;
    import javax.swing.JFrame;


    public class GuiFrame1 extends JFrame {
    private static final long serialVersionUID = 1L;
    private static JFrame frame;
    static GridLayout gLayout2 = new GridLayout(2,1);
    private GuiPanel2 panel;
    private GuiPanel1 panel2;
    public GuiFrame1(){

    super("Sudoku");
    setSize(700, 700);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setLayout(gLayout2);
    panel = new GuiPanel2();
    panel2 = new GuiPanel1();
    setVisible(true);
    add(panel);
    add(panel2);


    }
    public static void main(String[] args) {
        new GuiFrame1();
    }

    }

JPanel クラスが必要な場合は、手配できます。

4

1 に答える 1