title: How to format vertically with GridBagLayout
body: <p>I am making a project that uses a box and a <code>JComboBox</code> and want to use <code>GridBagLayout</code>. I want the combo box at the top center of the screen, then the <code>Box</code> with a <code>JTextArea</code> inside at the center. This is my code so far:</p>
  <pre><code>import java.awt.Color;
  import java.awt.GridBagConstraints;
  import java.awt.GridBagLayout;
  import java.awt.event.ItemListener;
  import java.awt.event.ItemEvent;
  import javax.swing.JFrame;
  import javax.swing.Box;
  import javax.swing.BoxLayout;
  import javax.swing.JTextArea;
  import javax.swing.JComboBox;
  
  /**comboBoxFrame Constructor
   * Takes Mouse Event Input From User
   * Based On Option Chosen By User From Dropdown, Displays Corresponding information, Taken From birtdayCaclulator.java
   */
  @SuppressWarnings(&quot;serial&quot;)
  public class comboBoxFrame extends JFrame {
      private final JComboBox&lt;String&gt; classComboBox;
      private JTextArea outputBox;
      
      private static final String[] names = {
              &quot;-Select-&quot;,
              &quot;Age Summary&quot;,
              &quot;Zodiac Sign&quot;,
              &quot;Birth Stone&quot;,
              &quot;Generation&quot;,
              &quot;Day of Week&quot;, 
              &quot;Lucky Number&quot;,
              &quot;Milestones&quot;, 
              &quot;First Presidential Election Vote&quot;,
              &quot;Days Since Last Birthday&quot;,
              &quot;Days Until Next Birthday&quot;,
              &quot;Animal Years Summary&quot;,
              &quot;Other Planet Age Summary&quot;,
              &quot;Days After Milestones Summary&quot;,
              &quot;Birthday Summary&quot;,
              &quot;Help&quot;
      };
      private static final String[] output = {
              &quot;Output will appear here&quot;,
              CreateDriver.bday.ageSummary(),
              CreateDriver.bday.getZodiacSign(),
              CreateDriver.bday.getBirthStone(),
              CreateDriver.bday.getGeneration(),
              CreateDriver.bday.getDayOfWeek(),
              CreateDriver.bday.getLuckyNum(),
              CreateDriver.bday.getMileStones(),
              CreateDriver.bday.getFirstPresElectionVote(),
              CreateDriver.bday.getDaysSinceLastBday(),
              CreateDriver.bday.getDaysTillNextBday(),
              CreateDriver.bday.animalYearsSummary(),
              CreateDriver.bday.otherPlanetAgeSummary(),
              CreateDriver.bday.getDaysAfterMilestonesSummary(),
              CreateDriver.bday.toString(),
              CreateDriver.bday.getHelp()
      };
      
      public comboBoxFrame() {
          super(&quot;Birthday Calculator&quot;);
          setLayout(new GridBagLayout());
          GridBagConstraints gbc = new GridBagConstraints();
          
          Box box = new Box(BoxLayout.Y_AXIS);    
          outputBox = new JTextArea(&quot;Output will appear here&quot;, 20, 50);
          box.add(outputBox, gbc);
          
          classComboBox = new JComboBox&lt;String&gt;(names);
          classComboBox.setMaximumRowCount(5);
                  
          classComboBox.addItemListener(
              new ItemListener() {
                  @Override
                  public void itemStateChanged(ItemEvent event) {
                      if (event.getStateChange() == ItemEvent.SELECTED) {
                          outputBox.setText(output[classComboBox.getSelectedIndex()]);
                      }
                  }
              }
          );
          
          add(classComboBox, gbc);
          outputBox = new JTextArea(&quot;Output will appear here&quot;);
          add(outputBox, gbc);
      }
  }
  </code></pre>
  <p>It currently prints the ComboBox and Box next to each other at the center Y Axis. Does anyone know what I should change to fix this?</p>