I am trying to make an application that is fullscreen in Java. I have three classes which extend JPanel that I want to add. Each of these have their own layout and components.

I am trying to use MiG Layout for the first time. I have a class which extends JFrame as the main window. This class has a panel using MiG, and the three other classes are added to this panel. Right now the main panel is appearing in the upper left and I want it to appear in the center. I tried making a "wrapper" panel that I could just center using BorderLayout but this doesn't seem to be working. I have tried a few other permutations but I feel like this should work and I don't understand why it isn't.

Here is the relevant code:

```
public class MainWindow extends JFrame {

private final int WINDOW_WIDTH = 800; //Width
private final int WINDOW_HEIGHT = 800; //Height

//three panel objects
private final IntroPanel header;
private final InputPanel input;
private final SubmitPanel submit;

//for fullscreen
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();

public MainWindow() throws MalformedURLException {

    //set things like size, close operation, etc
    this.Build();

    //Create a MiG layout
    MigLayout layout = new MigLayout("wrap 3");

    //panel which will hold three panels
    JPanel panel = new JPanel(layout);

    //initiate the three panels we need for user actions
    header = new IntroPanel();
    input = new InputPanel();
    submit = new SubmitPanel();

    panel.add(header, "span, center, gapbottom 15");
    panel.add(input, "span, center, gapbottom 15");
    panel.add(submit,"span, center, gapbottom 15");

    this.setLayout(new BorderLayout());
    add(panel, BorderLayout.CENTER);

    //set the windows position to the center of the screen
    setLocationRelativeTo(null);
    //Make the window visable
    setVisible(true);
}

```