This panel is used to organize everything this method does. It is inside a JFrame and everything works perfectly except that the positioning inside this one JPanel, which has it staggered(from left to right, there is showQuestionsPanel, new line aligned with bottom right of that we have the addQuestionPanel, then aligned with the bottom of the showquestions panel but to the right of the addQuestionsPanel we have the closeEQPanel, and to the right of that but below the addQuestionsPanel is the eqbuttonPanel). The closeEQPanel should be the top right panel, with showQuestionsPanel to its left, and immediately below should be the addQuestionPanel on the left with the eqbuttonPanel to the right, all aligned as a 2x2 grid. What do I have wrong in this layout?
//arrange visual elements/create main panel
JPanel mainEQPanel = new JPanel();
GroupLayout eqLayout = new GroupLayout(mainEQPanel);
mainEQPanel.setLayout(eqLayout);
eqLayout.setAutoCreateGaps(true);
eqLayout.setAutoCreateContainerGaps(true);
eqLayout.setHorizontalGroup(
eqLayout.createSequentialGroup()
.addGroup(eqLayout.createParallelGroup(GroupLayout.Alignment.TRAILING))
.addComponent(showQuestionsPanel)
.addComponent(addQuestionPanel)
.addGroup(eqLayout.createParallelGroup(GroupLayout.Alignment.CENTER))
.addComponent(closeEQPanel)
.addComponent(eqbuttonPanel)
);
eqLayout.setVerticalGroup(
eqLayout.createSequentialGroup()
.addGroup(eqLayout.createParallelGroup(GroupLayout.Alignment.LEADING))
.addComponent(showQuestionsPanel)
.addComponent(closeEQPanel)
.addGroup(eqLayout.createParallelGroup(GroupLayout.Alignment.LEADING))
.addComponent(addQuestionPanel)
.addComponent(eqbuttonPanel)
);